[PyKDE] bug on disconnecting short-circuited signals

Emanuele Santos emanuelesantos at gmail.com
Fri Apr 14 22:06:25 BST 2006


Hi, Phil
It seems that disconnecting a short-circuited signal is not working.  
I'm using PyQt4 20060406
Example:
from PyQt4 import QtCore, QtGui
import sys

class C(QtGui.QWidget):
     def __init__(self, parent=None):
	QtGui.QWidget.__init__(self,parent)
	self.n = 3
     def signal1(self, n):
	self.emit(QtCore.SIGNAL("signal1"),n)

class B(QtGui.QWidget):
     def __init__(self, parent=None):
	QtGui.QWidget.__init__(self,parent)
	self.n = 3
     def myprint(self, n):
	print n

class A(QtGui.QWidget):
     def __init__(self, parent=None):
	QtGui.QWidget.__init__(self,parent)
	self.c = C()
	self.b = B()
	self.connect(self.c,QtCore.SIGNAL("signal1"),self.b.myprint)
     def unplug(self):
	self.disconnect(self.c,QtCore.SIGNAL("signal1"),self.b.myprint)

if __name__ == "__main__":
     app = QtGui.QApplication(sys.argv)
     a = A()
     a.c.signal1(1)
     a.unplug()
     a.c.signal1(2)#it shouldn't print this

But if I use the full signature ("signal1(int)") it works.

--Emanuele






More information about the PyQt mailing list