[PyKDE] A working konsole part example in PyKDE

Reza Salari resal81 at yahoo.com
Thu Oct 26 13:53:02 BST 2006


Hi all, 
Here is an example of a working konsole kpart in PyKDE for who are looking for an example as I was yesterday! I created it using PyKHTML example provided by Jim in PyKDE examples. I don't know how I can implement a kpart as a widget in a PyQt application yet (anyone knows?), but if I find I will post it here. 

from kdecore import KCmdLineArgs, KApplication, KAboutData
from kdeui import KStdAction
from kparts import KParts, createReadOnlyPart

import sys

FALSE = 0
TRUE  = not FALSE

class konsoleMW (KParts.MainWindow):
        def __init__ (self, *args):
                apply (KParts.MainWindow.__init__, (self,) + args)
                quitAction = KStdAction.quit (self.close, self.actionCollection ())
                self.setGeometry (0, 0, 600, 500)

                               
                self.part = createReadOnlyPart ("libkonsolepart", self)
                self.w = self.part.widget ()
        self.w.setGeometry (30, 55, 500, 400);
                self.w.show ();
        def queryExit(self):
                #// this slot is invoked in addition when the *last* window is going
                #// to be closed. We could do some final cleanup here.
                return TRUE #// accept







aboutData = KAboutData ("KONSOLE", "PyKONSOLE","0.1","Konsole Part" , KAboutData.License_GPL,"(c) 2002, Jim Bublitz")

KCmdLineArgs.init (sys.argv, aboutData)
app = KApplication ()

if (app.isRestored()):
        RESTORE(KLess)
else:
        parts = konsoleMW (None, "pyParts")
        if len(sys.argv) > 1:
                args = KCmdLineArgs.parsedArgs()

parts.show()
app.exec_loop()




-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20061026/60e75651/attachment-0001.html


More information about the PyQt mailing list