[Kde-bindings] [Bug 184426] New: connect failed for signal in PyKDE4.kedui.KWindowSystem

Haoyu Bai divinekid at gmail.com
Sun Feb 15 16:31:38 UTC 2009


http://bugs.kde.org/show_bug.cgi?id=184426

           Summary: connect failed for signal in PyKDE4.kedui.KWindowSystem
           Product: bindings
           Version: unspecified
          Platform: unspecified
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: NOR
         Component: general
        AssignedTo: kde-bindings at kde.org
        ReportedBy: divinekid at gmail.com


Version:            (using KDE 4.2.0)
Compiler:          Python 2.6 and gcc 4.3.3 
OS:                Linux
Installed from:    Unlisted Binary Package

The following pykde program try to connect
KWindowSystem::activeWindowChange(WId) to a Python function. But it failed -
there's no exception raised when running, but the Python is not triggered when
window focus changed. Even more strange, QObject.connect doesn't raise any
exception when a non exist signal passed in (for example SIGNAL("balbal()"), is
that the normal behavior of connect()?

I'm using Archlinux, the version of PyQt is 4.4.4, sip is 4.7.9.


import sys
from PyQt4.QtCore import SIGNAL, SLOT, pyqtSignature, QObject
from PyQt4.QtGui import QApplication, QMainWindow
from PyKDE4.kdecore import ki18n, KAboutData, KCmdLineArgs
from PyKDE4.kdeui import KApplication, KMainWindow, KWindowSystem

class FocusListener(KMainWindow):
    def __init__(self):
        KMainWindow.__init__(self)
        kwin = KWindowSystem.self()
        QObject.connect(kwin, SIGNAL("activeWindowChanged(WId)"),
self.printChange)

    @pyqtSignature("int")
    def printChange(self, wid):
        print "Focus changed to", wid



def get_about():
    appName     = "TestKApplication"
    catalog     = "Test"
    programName = ki18n ("TestKApplication")
    version     = "1.0"
    description = ki18n ("Test KApplication")
    license     = KAboutData.License_GPL
    copyright   = ki18n ("(c) 2009 Haoyu Bai")
    text        = ki18n ("none")
    homePage    = "http://localhost"
    bugEmail    = "baihaoyu at gmail.com"

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

def main():
    aboutData = get_about()
    KCmdLineArgs.init(sys.argv, aboutData)
    app = KApplication()
    listener = FocusListener()
    listener.show()
    app.exec_()

if __name__=="__main__":
    main()


-- 
Configure bugmail: http://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the Kde-bindings mailing list