PyKDE
Files are in http://kubuntu.org/~jriddell/tutorials-day/python/
[15:00] <Riddell> Good Afternoon Friends [15:00] <Longfield> just in time [15:00] * wolfger is hopped up on "taking a vacation day to be here" [15:00] <Riddell> is anyone here for the PyQt tutorial? [15:00] <_nix_> Good Afternoon [15:00] <limac> it 10:00 eastern [15:00] <fmo> yes [15:00] <limac> me [15:00] <birunko> uha [15:00] <pexi> yes [15:00] <_nix_> yup [15:00] * nareshov raises his hand [15:00] <kenny> yep [15:00] <jussi01> Riddell: me! [15:00] <dthacker> yep [15:00] * Hobbsee is here to take over the world. [15:00] <Tolaris> yes [15:00] <apachelogger_> Riddell: I'm voting for bug triage so that I can leave again :P [15:00] <luis_lopez> yep [15:00] <sigma> its exactly 5pm in south africa [15:00] <wolfger> I'm here for everything [15:00] <jussi01> !hobbsee | Hobbsee [15:00] <ubotu> Hobbsee: I phear the stick so shhhhh [15:00] <pvandewyngaerde> Pyes [15:00] <Riddell> this channel has over doubled in size since it was announced, so some people must be [15:00] <_nix_> 2030 in India [15:00] <rebugger> its 4pm in germany [15:00] <limac> here for everything [15:00] <Panke> i am here for pykde. [15:00] <nareshov> Yo _nix_ [15:01] <meven> 4pm in France too [15:01] <limac> when is it starting? [15:01] <xRaich[o]2x> i here for everything [15:01] <Riddell> ok, now I look all important [15:01] <nixternal> w00t [15:01] * dthacker is here for the day. took a vacation day [15:01] <cheguevara> lol [15:01] <Riddell> this is our first time of running this [15:01] <Tolaris> I'm here for 15:00 UTC - 16:00 UTC: Packaging 101, not PyQT [15:01] <Tolaris> :) [15:01] <sigma> lol [15:01] <AddiKT1ve> hai [15:01] <Mondaar> ho..he has the "mark" [15:01] <Riddell> it may be a complete disaster [15:01] <AddiKT1ve> looks like everyone is conneting [15:01] <nosrednaekim> hey everyone! [15:01] <AddiKT1ve> connecting* [15:01] <cheguevara> thats the spirit.... [15:02] <limac> so who is our tutor? [15:02] * magnetron is connecting [15:02] <nareshov> limac: Riddell [15:02] * _nix_ gotta turn of JOINS PARTS QUITS [15:02] <nosrednaekim> Riddell :D [15:02] <Riddell> but hopefully we can help people learn something new and get into helping with Kubuntu, KDE and the causes of Freedom [15:02] <nixternal> Riddell: Vista was a complete disaster, what you are about to do my friend, is rock the stage :) [15:02] <apachelogger_> if it is a disaster we just do some hype promo :P [15:02] <stdin> Tolaris: if you read the link in the topic, you'll see Packaging 101 is 17:00 UTC - 18:00 UTC [15:02] <limac> Riddell: hey [15:02] <DreadKnight> vista made me discover linux and open source software xD [15:02] <Riddell> so, first thing, please keep discussion in #kubuntu [15:02] <Riddell> else we'll be drowned out [15:02] <nixternal> #kubuntu-offtopic rather [15:02] <nareshov> will this chan be +m'ed ? [15:02] <dthacker> perhaps #kubuntu-offtopic? [15:03] * Hobbsee_ kills konversation [15:03] <nosrednaekim> Riddell: is this going to be run like OpenWeek was? [15:03] <DreadKnight> #kubuntu_own_ye_all [15:03] <Riddell> you can ask questions here, I'm hoping we won't need to play with channel modes [15:03] <nareshov> or #kubuntu-classroom ? [15:03] <Hobbsee> nareshov: not if we don't have to [15:03] <nareshov> ok [15:03] <Riddell> just a quick rundown, PyQt/KDE now [15:03] <_nix_> nareshov: yo.. [15:03] <Riddell> bug triage in an hour [15:03] <Tolaris> thanks, stdin. it would have been nice if the web page had been updated. [15:03] <limac> yay [15:03] <Riddell> bzr in 1.5 hours [15:03] <Tolaris> See you later [15:03] <Riddell> packaging at 17:00 [15:04] <Riddell> get it into the archives at 18:00 [15:04] <Riddell> and general Q&A at 19:00 [15:04] <limac> so when r we beginning? [15:04] <Riddell> all times UTC [15:04] <Riddell> lets start [15:04] <limac> too anxious! [15:04] <limac> yay! [15:04] <Riddell> for this tutorial you'll need to apt-get install python-qt4 [15:04] <Riddell> if you're lucky you may be able to apt-get install python-kde4 [15:04] <Riddell> but it's still compiling away on some platforms, so it's not required [15:05] <Riddell> you'll also need to apt-get install qt4-designer [15:05] <mihas> y [15:05] <kwilliam> ok [15:05] <Riddell> files for the tutorial are at http://muse.19inch.net/~jr/kubuntu-tutorials-day/pykde/ [15:05] <Riddell> the slides at http://muse.19inch.net/~jr/kubuntu-tutorials-day/pykde/04-pyqt-tutorial.pdf I used for a tutorial earlier this year [15:06] <Riddell> and the first file you need is http://muse.19inch.net/~jr/kubuntu-tutorials-day/pykde/hola.py [15:06] <DreadKnight> !root pykde [15:06] <ubotu> Sorry, I don't know anything about root pykde - try searching on http://ubotu.ubuntu-nl.org/factoids.cgi [15:06] <Riddell> this is the world's easiest python app [15:06] <Riddell> #!/usr/bin/python [15:06] <Riddell> print "hola" [15:06] <Riddell> just prints out a message on the console [15:06] <Riddell> Python, as you should know, is a programming language [15:06] <Riddell> it's many times easier than C++ [15:07] <Riddell> and many many times easier than C [15:07] <Riddell> it's the perferred language for apps in Ubuntu distros [15:07] <DreadKnight> who wants to be my python tutor? ^^ [15:07] <kwilliam> hmm, I got a timeout on hola.py [15:07] <Riddell> it has its faults as Ruby programmers will say [15:07] <Straphka> is that the only content of hola.py? I cant download it [15:07] <nareshov> me too, contacting... [15:08] <mihas> got a timeout too, server busy :) [15:08] <cheguevara> doesn't load for me either [15:08] <nareshov> contacted. Waiting for reply... [15:08] <simpsus> me too [15:08] <nareshov> DreadKnight: you might want to read diveintopython [15:08] <birunko> still busy [15:08] <limac> python is way easier than c++: true, i agree [15:08] <limac> and c [15:08] <Riddell> you can also get the files from http://kubuntu.org/~jriddell/tutorials-day/python/ [15:08] <cheguevara> thats better :P [15:08] <nareshov> hola.py - lol [15:09] <ropiku> can you please keep discussions on other channel ? it's hard to watch what Riddell says [15:09] <Riddell> you can run the app with "python hola.py" [15:09] <Riddell> or you can make it executable with "chmod 755 hola.py" and run "./hola.py" [15:09] <kwilliam> much better download, thnx. [15:09] <Riddell> is that working for everyone? [15:09] <\sh> DreadKnight, visit http://diveintopython.org/ [15:09] <cheguevara> yep [15:09] <birunko> yup [15:09] <meven> yep [15:09] <DreadKnight> \sh: thanks :) [15:09] <fmo> yes [15:09] <limac> btw which one is more useful in general, c++ or python? [15:09] <tobixx> got it [15:10] <nosrednaekim> Riddell: sure [15:10] <kenny> yes [15:10] <DreadKnight> thats nice [15:10] <Riddell> so let's get graphical [15:10] <Riddell> hola2.py is a simple Qt application [15:10] <limac> yup [15:10] <Riddell> import sys [15:10] <Riddell> from PyQt4.QtGui import * [15:10] <Riddell> from PyQt4.QtCore import * [15:10] <Riddell> is how it starts [15:10] <Riddell> these tell python to load some libraries [15:11] <Riddell> the sys library does a bunch of basic bits, this app uses it for command line arguments [15:11] <Riddell> and the next two lines load the two more important Qt modules [15:11] <Riddell> then below the app itself [15:11] <Riddell> app = QApplication(sys.argv) [15:11] <Riddell> button = QPushButton("hola") [15:11] <Riddell> button.show() [15:11] <Riddell> app.exec_() [15:11] <Panke> is it a good habit too use import * for the modules? [15:12] <Riddell> we create a QApplication and call it "app" [15:12] <Riddell> Panke: you can also load individual Qt classes, but then you have to change the import line when you need a new class and that soon gets boring [15:12] <dennda> Panke: you'd have to type PyQt4.QtGui.something all the time otherwise [15:12] <Riddell> I don't think there's much memory disadvantage to just loading * in this case [15:12] <Straphka> can't exec it, "can't read /var/mail/PyQt4.QtGui" [15:12] <Straphka> that normal? [15:12] <mihas> from: can't read /var/mail/PyQt4.QtGui [15:12] <mihas> from: can't read /var/mail/PyQt4.QtCore [15:12] <mihas> ./hola2.py: line 5: syntax error near unexpected token `(' [15:12] <mihas> ./hola2.py: line 5: `app = QApplication(sys.argv)' [15:13] <Riddell> Straphka: I've no idea what's going on there [15:13] <nareshov> worked for me :| [15:13] <nosrednaekim> works fine for me. [15:13] <blizzzek> import: unable to read X window image `' [15:13] <Straphka> Riddell: ok, ill google it then [15:13] <cheguevara> works fine here [15:13] <nareshov> might need python-qt4-dev ? [15:13] <dfitzg> worked for me... do you have python-qt4? [15:13] <kenny> works for me as well [15:13] <teppic> you need to run python hola2.py, you can't chmod and execute it directly (as it stands) [15:14] <cheguevara> mihas, u forgot #!/usr/bin/python [15:14] <Riddell> mihas: are you missing the import lines? [15:14] <cheguevara> so its interpreting it as a bash script [15:14] <Riddell> oh yes, that's my fault, you can add "#!/usr/bin/python" at the top [15:14] <mihas> works now [15:14] <cheguevara> yeah or just run it through python not directly [15:14] <\sh> Riddell, change it to #!/usr/bin/env python ....it's better :) [15:14] <kwilliam> or simply run 'python hola2.py' [15:15] <kwilliam> no need to make it executable [15:15] <Riddell> has anyone been able to install python-kde3? [15:15] <dholbach> \sh: the debian policy is happier with #!/usr/bin/python [15:15] <Riddell> sorry [15:15] <Riddell> python-kde4 [15:15] <kenny> no, not here [15:15] <nareshov> Riddell: nope [15:15] <meven> not me [15:15] <nosrednaekim> Riddell: I have the 3.96 version [15:15] <Riddell> it should be in the KDE 4 gutsy PPA [15:15] <cheguevara> not on i386 [15:15] <Riddell> and may be in the hardy archives by now for i386 [15:15] <cheguevara> some of us are running hardy :P [15:15] <\sh> dholbach, well, we should not think only about debian ;) kde is happy on other distros too ;) [15:15] <Straphka> Riddell: just fyi, it works, same prob as mihas [15:16] <Riddell> if you have then take a look at hola2-kde.py [15:16] <dholbach> \sh: oh man :) [15:16] <cheguevara> let me apt-get update [15:16] <xRaich[o]2x> python-kde4 works with the ppa repo [15:16] <Riddell> Straphka: do you have the import lines? and are you running it with "python hola2.py" ? [15:16] <cheguevara> E: Couldn't find package python-kde4 [15:16] <kenny> same error [15:16] <Straphka> Riddell: I meant that I made it executable without specifying the interpeter [15:17] <kenny> what's the repo for it? [15:17] <stdin> cheguevara: you need the KDE4 PPA repository [15:17] <Riddell> if you can't install python-kde4 don't worry [15:17] <nareshov> ok [15:17] <cheguevara> stdin, aint that PPA gutsy? [15:17] <tobixx> ImportError: No module named PyKDE4.kdecore [15:17] <Riddell> the package isn't available everywhere yet, it's very new [15:17] <stdin> "deb http://ppa.launchpad.net/kubuntu-members-kde4/ubuntu/ gutsy main" [15:17] <Riddell> only uploaded yesterday [15:17] <cheguevara> stdin, hardy here [15:17] <Riddell> and it's still experimental [15:17] <Riddell> but it adds KDE integration so it can make apps feel more at home in KDE [15:17] <Riddell> hola2-kde.py changes the Qt import lines [15:17] <Riddell> from PyKDE4.kdecore import * [15:17] <Riddell> from PyKDE4.kdeui import * [15:18] <Riddell> so now we're loading up the KDE libraries (which in turn load up Qt) [15:18] <Riddell> KDE also needs us to declaire some data about the app [15:18] <Riddell> KCmdLineArgs.init(sys.argv, "pykdeapp", "", ki18n("PyKDE App"), "0.1", ki18n("My first app")); [15:18] <Riddell> which tells it the name of the app and a description [15:18] <Riddell> you also need to change QApplication to KApplication [15:18] <Riddell> and voila, a PyKDE app [15:19] <Riddell> anyone got it working? [15:19] <nosrednaekim> Riddell: looks nice and oxygen-y to me :D [15:19] <Riddell> excellent, gold star to nosrednaekim [15:19] <kwilliam> yep! hey oxygen [15:19] <mihas> nice [15:19] <simpsus> No module named PyKDE4.kdecore [15:19] <kenny> whats the ki18n for? [15:19] <Riddell> simpsus: you probably don't have python-kde4 installed [15:19] <mihas> but why button? [15:19] <nareshov> some internationalization thing perhaps [15:19] <D_Ed> ki18n translates to the user language [15:19] <Riddell> kenny: ki18n() is for translations [15:19] <Janz> Ridell: I'm trying to wait for best moment to ask that (specially when no one is having trouble) but, as I'm not finding (sorry), we'll see plasmoids development here, too? [15:19] <Daisuke_Laptop> awww, i got here too late [15:20] <simpsus> yes, its not there, but nevermind, ill skip this [15:20] <DreadKnight> i18n it's the internationalization project [15:20] <Riddell> mihas: a button is just a simple widget, we'll move on to a text edit in a moment [15:20] <kenny> ok, cool, didn't know that [15:20] <Riddell> any questions so far? [15:20] <DreadKnight> any romanian people around here? [15:20] <Janz> Ridell: I mean, later ... [15:20] <Riddell> on topic questions I ment [15:20] <nosrednaekim> Riddell: yes, how does it know that you want a qpuchbotton on that app? [15:20] <stdin> DreadKnight: questions about the tutorial only please [15:20] <Straphka> so we do not have to have python-kde4? [15:21] <Janz> Riddell: really sorry for that. [15:21] <Riddell> nosrednaekim: we create a button with button = QPushButton("hola") [15:21] <Riddell> and show it on the next line [15:21] <tseliot> Where can I find the examples ( hola2.py etc.) ? [15:21] <nosrednaekim> Riddell: yes, but what if we have two qapplication instances? [15:21] <Riddell> tseliot: http://kubuntu.org/~jriddell/tutorials-day/python/ [15:21] <nareshov> ooh, the button is nice :) [15:21] <Riddell> nosrednaekim: you can only have one QApplication instance [15:21] <blizzzek> ImportError: No module named PyKDE4.QtGui <-- got this error [15:21] <dholbach> hey tseliot [15:21] <Riddell> nosrednaekim: but you can have more than one button if you want [15:21] <nosrednaekim> Riddell: ah,ok thanks [15:21] <nareshov> blizzzek: add the ppa repo [15:22] <tseliot> riddel: thanks [15:22] <Riddell> the final line, app.exec_() runs the main loop [15:22] <tseliot> dholbach: hi [15:22] <blizzzek> na, my error it seems [15:22] <Riddell> most GUI applications spend most of their time sitting in the main loop waiting for things to ahppen [15:22] <Riddell> like pressing the button [15:22] <nareshov> oh, polling? [15:22] <kenny> i added the ppa repo, but i keep getting kdebase-runtime-bin is a dependency, but it won't install it [15:23] <meven> kenny: same by me [15:23] <Riddell> nareshov: it's not polling, that would consume resources, it just sits and waits for something to happen [15:23] <nareshov> okay [15:23] <nosrednaekim> python-kde4 really isn't necesary everyone, almost everything is done preciself the same in python-qt4 [15:23] <Riddell> blizzzek: do you have python-qt4 installed? [15:23] <Riddell> let's move on [15:24] <Riddell> for this next trick you'll need qt4-designer installed [15:24] <Riddell> which you run with "designer-qt4" (or from the k-menu) [15:24] <blizzzek> Riddell: i have [15:24] <Riddell> select a widget and click Create [15:24] <Riddell> we're going to make a simple text editor [15:24] <kenny> sweet [15:25] <Riddell> Qt has a widget called QTextEdit [15:25] <DreadKnight> riddell would you like to stream your screeny over the net? [15:25] <bddebian> Heya [15:25] <Riddell> which you can find in the designer toolbox under Input Widgets [15:25] <Riddell> drag one of those to the blank widget (which is covered in a grid of dots) [15:25] <Riddell> http://kubuntu.org/~jriddell/tutorials-day/python/editor1-designer1.png [15:25] <Riddell> looks like that [15:26] <dthacker> my first changes are crashing. where should the KCmdLineArgs line go? [15:26] <Riddell> dthacker: first thing usually [15:27] <dthacker> before imports? [15:27] <Riddell> dthacker: after them [15:27] <nareshov> right after that [15:27] <Artemis_Fowl> includes you mean [15:27] <dthacker> ok, other problems then [15:27] <wolfger> I don't see a QTextEdit, just TextEdit. Same thing? [15:27] <Riddell> qt designer working for people? [15:27] <nareshov> yeah [15:27] <Riddell> wolfger: that's the one [15:27] <Artemis_Fowl> ah, its python talking [15:27] <stijn_> ype [15:27] <pexi> yes, without problems [15:28] <Riddell> now we fit the textEdit widget to the widget [15:28] <nareshov> done [15:28] <Riddell> click on the background of the widget (with the grid of dots) [15:28] <Riddell> then click the "Lay Out Vertically" button in the designer toolbar [15:28] <Riddell> you might need to make the toolbox window wider, it usually gets hidden [15:29] <Riddell> you should end up with http://kubuntu.org/~jriddell/tutorials-day/python/editor1-designer2.png [15:29] <Riddell> the TextEdit widget snaps to the edges of the widget [15:29] <Riddell> working? [15:29] <cheguevara> yep [15:29] <meven> ok [15:29] <pexi> yes [15:29] <nareshov> yes [15:29] <Riddell> save that file as editor.ui [15:29] <Riddell> in the same place as your python apps are [15:29] <kenny> yes [15:30] <Riddell> you can also just get http://muse.19inch.net/~jr/kubuntu-tutorials-day/pykde/editor.ui [15:30] <Riddell> now we need an app to use our text edit [15:30] <Riddell> http://muse.19inch.net/~jr/kubuntu-tutorials-day/pykde/editor.py [15:30] <nareshov> neat, some sort of xml [15:30] <Riddell> yes, .ui files are just XML [15:30] <xRaich[o]2x> nareshov: it is xml ;) [15:30] <nareshov> heh, k [15:30] <DreadKnight> Riddell: this text editor can be used as an plasma applet? [15:30] <DreadKnight> a* [15:31] <AddiKT1ve> DreadKnight, it would rock :o [15:31] <Riddell> any user interface that's at all complex should be made in a GUI tool like Qt Designer [15:31] <Riddell> otherwise you spend forever creating the widgets by hand and laying them out in your code [15:31] <Riddell> editor.py is pretty similar to the previous examples [15:31] <nareshov> I see [15:32] <Riddell> DreadKnight: I don't know if plasma has python bindings yet, but once it gets those it can be [15:32] <DreadKnight> i think Knotes will work with plasma... [15:32] <DreadKnight> Riddell: i see, thanks :) [15:32] <fmo> how well that is stretch with different screen resolutions? [15:32] <Artemis_Fowl> Riddell: does Qt Designer support KDE widgets such as KTextEdit or KListWidget etc.? [15:32] <Riddell> instead of creating a QPushButton we're making a QWidget which is a blank widget [15:32] <Riddell> then we load our designer file onto that blank widget [15:32] <nosrednaekim> Artemis_Fowl: yes [15:32] <Riddell> Artemis_Fowl: yes it support KDE widgets if the plugins have been compiled [15:33] <Riddell> so [15:33] <Artemis_Fowl> and how is this done? [15:33] <Riddell> widget = QWidget() [15:33] <Riddell> uic.loadUi("editor.ui", widget) [15:33] <Riddell> widget.show() [15:33] <Riddell> create the blank widget [15:33] <Riddell> load the designer file onto that widget [15:33] <Riddell> and show the widget [15:33] <Riddell> voila, a text editor app [15:33] <nareshov> neat [15:33] <nosrednaekim> Riddell: umm didn't we skip the pyuic4 step? [15:33] <kenny> easy enough [15:34] <kwilliam> wow... my kde session crashed. [15:34] <anand> nice [15:34] <nareshov> heh [15:34] <kwilliam> whats happened? [15:34] <Riddell> Artemis_Fowl: it should "just work" if all the packages are installed, but it hasn't been well tested and it may well not work with the Kubuntu packages yet [15:34] <Riddell> nosrednaekim: we're not using pyuic4 [15:34] <Riddell> there's two ways to load .ui Designer files [15:34] <nosrednaekim> Riddell: how is it loading the .ui file? [15:34] <Riddell> you can compile them to code with uic (C++) or pyuic4 (python) [15:34] <Riddell> or you can just miss that step and load them directly from the .ui file [15:35] <Riddell> personally I don't see any advantage in compiling it, but it might be fractionally faster to run [15:35] <kenny> is there a speed difference between either method? [15:35] <cheguevara> nosrednaekim, uic.loadUi("editor.ui", widget) [15:35] <nosrednaekim> Riddell: ah, ok, I see [15:35] <kenny> ok [15:35] <nareshov> we imported uic from PyQt4 ? [15:35] <Riddell> I forgot we also need an import line [15:35] <Riddell> "from PyQt4 import uic" [15:35] <Riddell> so that's loading the pyQt module for handling .ui files [15:35] <Riddell> uic is the .ui compiler [15:35] <nareshov> ah [15:35] <Riddell> kenny: try it and see, I doubt it's measurable [15:35] <nosrednaekim> ok, great, I guess i'm still kinda stuck in qt3 ;) [15:36] <Riddell> any more questions? [15:36] <kenny> well, it was quick enough for me, i was just curious [15:36] <DreadKnight> Riddell: will you start this all over again? xD [15:36] <kenny> DreadKnight: this thing is logged [15:36] <nosrednaekim> DreadKnight: read the logs :D [15:36] <DreadKnight> i know :) [15:36] <kwilliam> yeah [15:36] <nareshov> Riddell: how do you read line 8 ? [15:36] <DreadKnight> not a coder >_< [15:36] <Riddell> it's logged, and there's plenty of time for more guidance after these sessions if you're lost [15:36] <kwilliam> what file are we working on? :-) [15:36] <Riddell> nareshov: which line is that? [15:36] <Riddell> kwilliam: editor.py [15:36] <nareshov> uic.loadUi [15:36] <Riddell> and editor.ui [15:37] <kwilliam> ok [15:37] <Riddell> nareshov: uic is the PyQt module we imported yearler [15:37] <Riddell> loadUi is a function is has to load the .ui file [15:37] <Riddell> Python is object orientated [15:37] <nareshov> onto the "widget"? [15:37] <nareshov> ok [15:37] <Riddell> objects are data structures with variables and methods (functions) [15:38] <Riddell> all the Qt widgets are objects [15:38] <nareshov> okay [15:38] <Riddell> and so it PyQt4.uic which has the method called loadUi [15:38] <nareshov> ah [15:38] <Daisuke_Laptop> sounds java-y [15:38] <Artemis_Fowl> Riddell: seems to be working even though I use Kubuntu. not fully tested though....... [15:38] <anand> are you going to talk about jambi (QT-Java) [15:39] <Riddell> I should say that a widget is any graphical item on the screen, text boxes, buttons, scrollbars, toolbars, they're all widgets [15:39] <Riddell> anand: not today [15:39] <Riddell> lets move on to editor2.py [15:39] <mihas> ok [15:39] <kenny> yep [15:39] <Riddell> go back to designer [15:40] <Riddell> you should still have the text box we made earlier [15:40] <Riddell> drag a PushButton from the toolbox to your widget, below the text box [15:40] <Riddell> it should end up like http://muse.19inch.net/~jr/kubuntu-tutorials-day/pykde/editor2-designer1.png [15:40] <Riddell> and Save As editor2.ui [15:41] <Riddell> working? [15:41] <Straphka> yur [15:41] <cheguevara> aye [15:41] <nosrednaekim> k [15:41] <Riddell> so now we're going to add an action to our application [15:41] <pexi> yes [15:41] <Hobbsee> oh, grumble. hal never properly upgrades in a chroot. [15:41] <kenny> yep [15:41] <Riddell> until now we've been creating widgets but not doing anything with them [15:41] <nosrednaekim> Hobbsee: off-topic ) [15:41] <Riddell> to add an action we need to start making our own objects [15:41] <nosrednaekim> ;) [15:42] <Riddell> so take a look at editor2.py [15:42] <Riddell> instead of just making a QWidget and using that [15:42] * Hobbsee sticks a few redback spiders down nosrednaekim's back, and heads in the direction of back [15:42] <Riddell> we define our own object called Editor which is based on a QWidget [15:42] <Hobbsee> er, bed. [15:42] <Riddell> a template for an object is called a class [15:42] <RinTinTigger> Hello [15:43] <Riddell> class Editor(QWidget): [15:43] <Riddell> there's our object template (class) [15:43] <Riddell> and it includes a couple of functions [15:43] <Riddell> in python there's a special function for each object with the lovely name of __init__(self): [15:43] <Riddell> which is run whenever that object is created [15:44] <nareshov> like the main() thing? [15:44] <Riddell> nareshov: main() is when the application is running (in C/C++), this is a constructor [15:44] <kenny> or more like an object constructor from c++? [15:44] <nareshov> ah, a constructor thing? [15:44] <Riddell> exactly [15:44] <iRon> nareshov: like constructors in c++/java .. [15:44] <nareshov> got it [15:44] <kenny> woo hoo, i got something right! [15:44] <Riddell> the first thing it has to do is run the init() for the QWidget [15:45] <Riddell> then it loads our .ui file [15:45] <Riddell> next, the exciting bit, we tell is what to do when someone clicks the button [15:45] <Riddell> this is the Qt signal/slot mechanism [15:45] <kwilliam> hurray! [15:45] <Riddell> widgets have signals when something interesting happens [15:45] <Riddell> you can find them in the Qt docs [15:45] <nareshov> okay [15:46] <Riddell> and we slot it into a function called save() [15:46] <RinTinTigger> Sry....a question...is "Packaging 101" done already [15:46] <Riddell> RinTinTigger: 15 minutes [15:46] <kwilliam> no [15:46] <_nix_> RinTinTigger: nope.. [15:46] <RinTinTigger> TY guys [15:46] <Riddell> next is another method [15:46] <stdin> RinTinTigger: see the link in the topic for session times [15:46] <Riddell> (method is another name for function, it just means a bunch of lines of code with a name) [15:46] <Riddell> the save() method will save the file [15:47] <RinTinTigger> i saw...and thee was said they switched time with Pykde4 ...so.....no matter ill wait [15:47] <Riddell> here all it's doing is printing out to the command line [15:47] <Riddell> RinTinTigger: oh, it's an hour and 15 minutes, sorry [15:47] <RinTinTigger> so like 6pm cet [15:47] <Riddell> self.textEdit is our textEdit widget [15:47] <Riddell> the name textEdit was given by Qt Designer [15:48] <Straphka> so Editor gets all the functions defined in the ui file? [15:48] <Riddell> and .toPlainText() is a method that QTextEdits have [15:48] <Straphka> with the loadUi function I mean [15:48] <Riddell> Straphka: it gets the names of objects defined [15:48] <Straphka> Riddell: okis [15:48] <Riddell> Straphka: the functions themselves, like .toPlainText, are defined by the Qt library [15:49] <Straphka> but I get the ui stuff in the editor namespace [15:49] <Riddell> you can see all the functions that a QTextEdit has at the all important Qt docs http://doc.trolltech.com/4.3/qtextedit.html [15:49] <Riddell> Straphka: I don't understand [15:50] <Riddell> anyone got it working? [15:50] <cheguevara> yeah works fine [15:50] <pexi> yes [15:50] <meven> yep [15:50] <pexi> it's work fine [15:50] <kwilliam> yes [15:50] <nareshov> works fine [15:50] <kenny> yep [15:50] <Straphka> Riddell: I mean I get access to everythong defined in the .ui file from the Editor class (as in self.x, where x is defined in .ui) [15:50] <aos101> yes [15:50] <Straphka> everything* [15:50] <Riddell> excellent excellent [15:50] <kwilliam> Straphka: yes, i think so [15:50] <nosrednaekim> Riddell: eh....I can't type in the text edit. [15:51] <txwikinger> Straphka: If you click on the textEdit object in Qt4-designer and look at the property window you will see the name [15:51] <nosrednaekim> Riddell: oh wait....duh,my error [15:51] <Riddell> Straphka: you do indeed, loadUi() does clever things to create all the objects into the current class [15:51] <darx> would the tutorial be archived and if yes where can i access it? [15:51] <Straphka> Riddell: that was exactly my question:) [15:51] <Riddell> darx: yes, I'll blog about that when it's done [15:51] <darx> cool [15:51] <nareshov> Riddell: what exactly is putting the text in the textEdit widget onto the console? [15:52] <Riddell> nareshov: the save() method there [15:52] <nareshov> oh, print [15:52] <nareshov> right [15:52] <nareshov> got it [15:52] <Riddell> and save() is being run by our signal to slot connection [15:52] <nareshov> neat [15:52] <kenny> are we going to go over saving to a file? [15:52] <Riddell> saving to a file is covered in editor3.py [15:53] <Riddell> well, opening from a file is [15:53] <Straphka> kenny: you could just do open(file, 'w') in python and write it out [15:53] <Riddell> but I think we're out of time for that [15:53] <kenny> cool, i jumped the gun there [15:53] <kenny> Straphka: thanks! [15:53] <Riddell> you just need to add an "open" button and use a QFileDialog to select the file [15:53] <Riddell> but we're out of time to cover it properly [15:53] <nareshov> ah [15:54] <kwilliam> are qt3 .ui files compatible with qt4? [15:54] <Riddell> kwilliam: not at all [15:54] <Riddell> kwilliam: but if you open them in qt4 designer it should convert it [15:54] <kwilliam> Riddell: thank you [15:54] <Riddell> so that's all we have time for [15:54] <Riddell> remember the docs, Qt has the best library docs there are http://doc.trolltech.com/4.3/ [15:55] <Riddell> and KDE has top docs too at api.kde.org [15:55] <Straphka> Riddell: whatd the url of your blog? [15:55] <Straphka> what's* [15:55] <Riddell> and tutorials at techbase.kde.org [15:55] <kwilliam> Thanks for the tutorial! [15:55] <pexi> Riddell: thank you very much [15:55] <nosrednaekim> and there are python translations of those docs too. [15:55] <nareshov> Riddell: thanks a lot dude! [15:55] <kenny> thanks a bunch, this was very helpful!! [15:55] <Riddell> most of our Kubuntu specific programming is done in python [15:55] <_nix_> Riddle: thanks a lot.. this will be useful [15:55] <bazhang> thank you very much Riddell [15:55] <xRaich[o]2x> good work, nice tutorial [15:55] <luis_lopez> Ridell: Muchas gracias! [15:55] <D_Ed> thanks. [15:55] <Riddell> so stick around, and if you want to become an elite free software developer (it's easy really) just ask and we'll find something that needs done [15:55] <daskreech> Hooray Riddell :) [15:55] <fmo> Riddell:Thx a lot [15:56] <aos101> Thanks. Great Tutorial. [15:56] <_nix_> boy we still have 5 min here.. [15:56] <nosrednaekim> thanks... I definately learned something. [15:56] <limac> man I missed it! [15:56] <limac> :( [15:56] <Riddell> the PyKDE packages are very new, still compiling for some platforms [15:56] <_nix_> limac: its ok.. there should be downloadable logs somewhere [15:56] <xRaich[o]2x> python looks quite nice but i guess i will stick with qt4/C++ ^^ [15:56] <PJC121> bah, I missed the first part, need your blog addy Riddell :) shame cos you did a great job [15:56] <dthacker> tnx Riddell, if we have questions after reading the logs, where is the best place to ask them? [15:56] <Riddell> but do give that a shot, techbase.kde.org is a wiki and is in need of tutorials [15:56] <Riddell> my blog is on planet.ubuntu.com [15:56] <PJC121> thank you [15:57] <meven> Riddell: could we extend a little for further question [15:57] <limac> _nix: where? [15:57] <meven> in another chanel [15:57] <Riddell> and quick questions? [15:57] <daskreech> limac: Riddell will have a link in his blog [15:57] <_nix_> limac: I dunno.. gotta find that out.. [15:57] <Riddell> we have a couple of minutes [15:57] <Riddell> there's a lot of concepts involved in object orientated programming [15:57] <Riddell> so if it's new to you can you got lost today, don't worry [15:57] <meven> more or less i would like to ohow to make a toolbox like real text editor [15:58] <nosrednaekim> Riddell: as dthacker asked, where's the best place for future questions? [15:58] <nosrednaekim> meven: user ktextedit. [15:58] <meven> otherwise i will use my browser no problem :) [15:58] <nosrednaekim> *use [15:58] <Straphka> Riddell: are there more widgets available than I see in designer? [15:58] <Straphka> Riddell: liek the filedialog you mentioned [15:58] <nareshov> Riddell: that desktop of yours in the screenshot - is that hardy? [15:58] <Riddell> Straphka: plenty http://doc.trolltech.com/4.3/classes.html [15:59] <DreadKnight> kde4 [15:59] <Straphka> Riddell: I can add those to designer as well I mean? [15:59] <Riddell> QFileDialogue is a full dialogue, you don't embed it in your own widgets, so it's not in designer [15:59] <Straphka> Riddell: with the nice icon and all [15:59] <cheguevara> Straphka, thats kde 4 [15:59] <Riddell> you can ask questions in #kubuntu afterwards or #kde-devel generally [16:00] <Riddell> or here if it's Kubuntu related [16:00] <Riddell> ok, time up [16:00] <Straphka> cheguevara: eh? [16:00] <cheguevara> sorry wrong nick lol [16:00] <Straphka> oh:) [16:00] <Riddell> txwikinger: how ready are you? [16:00] <cheguevara> that was to nareshov , its kde4 [16:00] <txwikinger> I am ready Riddell [16:00] <meven> thX Riddell [16:00] <nosrednaekim> Thanks Riddell...sorry, can't stick around for the next session [16:00] <nosrednaekim> good luck txwikinger [16:00] <nareshov> cheguevara: is it the kde4 from the ppa repo for gutsy? [16:00] <darx> Has the tut started? [16:01] <txwikinger> ok.. let just slide into the next tutorial -- bug triage [16:01] <sigma> first session is over [16:01] <stdin> This session: kubuntu bug triage with txwikinger [16:01] <darx> ok [16:01] <cheguevara> nareshov, either that or from hardy, they look exactly the same :P [16:01] <Riddell> over to txwikinger [16:01] <dholbach> Riddell: well done! [16:01] <cheguevara> yeah thanks Riddell [16:01] <txwikinger> Ok... let's just start ... please feel free to ask questions at any time [16:02] <txwikinger> And stop me if I get to be too fast [16:02] <PJC121> okies [16:02] <nareshov> sure :} [16:02] <fadey> ok [16:02] <txwikinger> The first question is: what is bug triage [16:02] <cheguevara> Riddell: may wanna change the topic [16:02] <txwikinger> The word triage comes from the French word trier which means sorting, sifting (see http://www.m-w.com/cgi-bin/dictionary?book=Dictionary&va=triage) [16:02] <elisiano_> exactly, I was ashamed to ask