[PyQt] emit python object as signal argument, get float in the slot

Dave Fancella dave at davefancella.com
Sat Jun 2 08:28:23 BST 2007


All,

For some reason when I emit a signal using the short-circuit method to give it 
a python object, when it reaches the other end I have a float.  This is only 
happening in Kubuntu (feisty), with python 2.5, pyqt4.2 and qt4.2.3.  In 
Mandriva, with slightly older python (but same qt and pyqt), the code works 
fine.  Is this a python 2.5 problem?

Here's the code:

In my main window class:
    def _connectSlots(self):
        QtCore.QObject.connect( self.__proxy, QtCore.SIGNAL("chat"), 
self.chatShow)

In the QObject that emits the signal:  (This is a class that inherits QObject 
solely to give me the emit method)

    def PostEvent(self, theEvent):
        if theEvent.atype == "CHAT":
            self.emit( QtCore.SIGNAL("chat"), theEvent)

And when received by the chatShow method, it is of type float.

The whole code can be had from 
https://svn.davefancella.com/eugenics/trunk/eugenics

The files are:
libeugenicsgui/mainqt.py
libeugenicsgui/qt_proxy.py
libeugenics/network/events/chat_event.py  <-- an instance of this class is the 
argument that's being converted to float

Did I do something braindead, or what?  The same code in Windows with Python 
2.5 (same qt and pyqt versions) works.  Only in Kubuntu am I suffering.

Thanks
Dave


More information about the PyQt mailing list