[PyQt] Konsole part doesn't emit "destroyed()" signal on "exit"

Shamakhov Andrey shamakhov.a at gmail.com
Wed Nov 4 13:43:02 GMT 2009


Hello!

I have a program like this:

####################################
#!/usr/bin/python                                                                                            

import sys
import os 

from PyKDE4.kdecore import *
from PyKDE4.kdeui import *  
from PyKDE4.kparts import * 

from PyQt4.QtCore import *
from PyQt4.QtGui import * 

class MainWindow (KMainWindow):
    def __init__ (self):       
        KMainWindow.__init__(self)
        self.resize(640, 480)     
        factory = KLibLoader.self().factory("libkonsolepart")
        self.part = factory.create(self, "KonsolePart")      
        self.connect(self.part, SIGNAL("destroyed()"), self.readd)
        self.setCentralWidget(self.part.widget())                 
        self.part.openUrl(KUrl.fromPath(os.environ['HOME']))      

    def readd(self):
        print "Wow!"
        factory = KLibLoader.self().factory("libkonsolepart")
        self.part = factory.create(self, "KonsolePart")      
        self.connect(self.part, SIGNAL("destroyed()"), self.readd)
        self.setCentralWidget(self.part.widget())
        self.part.openUrl(KUrl.fromPath(os.environ['HOME']))

if __name__ == '__main__':

    appName     = "Konsolepart_example"
    catalog     = ""
    programName = ki18n("Konsole Part Example")
    version     = "1.0"
    description = ki18n("Example loading a Konsole Part")
    license     = KAboutData.License_GPL
    copyright   = ki18n("(c)")
    text        = ki18n("none")
    homePage    = "localhost"
    bugEmail    = "none"

    aboutData   = KAboutData(appName, catalog, programName, version,  
description,
                license, copyright, text, homePage, bugEmail)

    KCmdLineArgs.init(sys.argv, aboutData)
    app = KApplication()
    mainWindow = MainWindow()
    mainWindow.show()
    app.exec_()
###################################

When you close opened console session, the "destroyed()" signal doesn't emited 
by konsole part on system with new version of PyKDE(4.3.3)(or/and 
PyQt(4.6.1)). This program works absolutely fine on system with PyKDE 4.3.1 
and PyQt 4.5.2. What is wrong in this code now?

Sorry for my english and thanks.  


More information about the PyQt mailing list