[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    [PyQt] small test crashing
From:       Marcos Dione <mdione () grulic ! org ! ar>
Date:       2010-12-12 11:21:52
Message-ID: 20101212112152.GR25035 () mustang ! petitcba ! net
[Download RAW message or body]


    trying to find if there was anything wrong with KAction (I have a piece of
code that uses a global shortcut, but it's not working) I scrambled this small 
test:

---cut here---
from PyKDE4.kdecore import KCmdLineArgs, KAboutData, i18n, ki18n
from PyKDE4.kdeui import KApplication
from PyKDE4.kdeui import KXmlGuiWindow, KGlobalSettings, KActionCollection
from PyKDE4.kdeui import KAction, KShortcut
from PyQt4.QtCore import Qt
from PyQt4.QtCore import pyqtSignal
import sys

class Win (KXmlGuiWindow):

    finished= pyqtSignal ()

    def result (self):
        print ("Win.result(): ping!");
        self.finished.emit ()


def main (args=sys.argv):
    appName     = "foo"
    catalog     = ""
    programName = ki18n ("foo")                 #ki18n required here
    version     = "0.0.0.0.1"
    description = ki18n ("moo")         #ki18n required here
    license     = KAboutData.License_GPL
    copyright   = ki18n ("(c) 2009, 2010 Marcos Dione")    #ki18n required here
    text        = ki18n ("none")                    #ki18n required here
    homePage    = ""
    bugEmail    = "mdione@grulic.org.ar"

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

    KCmdLineArgs.init (args, aboutData)

    app= KApplication ()

    win= Win ()
    action= KAction ("foo/man/chu", win)
    action.setObjectName ("foo/man/chu")
    action.setGlobalShortcut (KShortcut (Qt.Key_MediaNext))
    win.actionCollection().addAction ("satyr.player.net", action)
    action.triggered.connect (win.result)

    win.show ()

    win.finished.connect (app.quit)
    return app.exec_ ()

main ()
---cut here---

    this example crashes when the signal is fired. I feel that this is not
a bug in PyQt4/PyKDE4, but an error in the ways I use it. like not knowing
some "do no t do this" gideline. am I missing something? FYI, this is Debian
Sid with all official packages as of last thursday.

-- 
(Not so) Random fortune:
merging with svn seems to always be an "Oh good Lord! We have to MERGE!" event
	    -- Mike Fletcher.
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic