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

List:       pykde
Subject:    [PyQt]  multiple inheritance and signals problem, mixin before QObject
From:       lloyd konneker <bootch () nc ! rr ! com>
Date:       2013-09-12 14:30:06
Message-ID: 5231CFEE.9020801 () nc ! rr ! com
[Download RAW message or body]

This is an update to my previous post.
Here is an abstract of the code for easier reading:


class B(object):
   def __init__(self):
     self.a1 = A()
     self.a1.signal1.connect(self.handler)    # Fails in PyQt, succeeds 
in PySide

   def handler(self):
     pass


class A (Mixin, SubclassOfQObject):
   def __init__(self):
     super().__init__()

class Mixin(object):
   signal1 = Signal()
   def __init__(self):
     super().__init__()



Again, AFAIK this works in PySide, but not in PyQt.
The MRO of a1, an instance of class A, is (Mixin, SubclassOfQObject, 
QObject, object).
And Mixin.__init__ calls super, which calls QObject.__init__ for 
instance a1,
so the signal instance should be bound by the time its connect method is 
called?

I found that a workaround is to eliminate the mixin:


class A (SubclassOfQObject):
   signal1 = Signal()
   def __init__(self):
     super().__init__()

   ... methods that were in Mixin ...


I just don't understand why.  Should I submit an executable test case?

_______________________________________________
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