[PyQt] inheriting from QObject and dbus.service.Object

Phil Thompson phil at riverbankcomputing.com
Thu Aug 13 21:59:30 BST 2009


On Thu, 13 Aug 2009 17:12:52 +0200, Marcos Dione <mdione at grulic.org.ar>
wrote:
> On Wed, Aug 12, 2009 at 09:23:07AM +0100, Phil Thompson wrote:
>> PyQt defines its own metaclass (as "print type(QObject)" demonstrates).
> 
>     here's the output:
> 
> In [47]: print type(QObject)
> <type 'PyQt4.QtCore.pyqtWrapperType'>
> 
> In [53]: QtCore.pyqtWrapperType
> AttributeError: 'module' object has no attribute 'pyqtWrapperType'
> 
>     no cigar. is there any way to publish it? that way I will be able to
do
> something like this:
> 
> In [52]: class meatbongs (QtCore.pyqtWrapperType,
> dbus.service.InterfaceType): pass
> 
>     and then use it as the metaclass of the inheriting class.

It is already available as type(QObject). However it is also available as
QtCore.pyqtWrapperType in the current snapshot.

>> It's a fundamental problem with Python's implementation that you get
>> meta-class conflicts that prevent you using multiple inheritance when
you
>> might want to. It would be nice to be able to (somehow) specify multiple
>> meta-class calls in a similar way that a derived class's __init__
>> explicitly calls the __init__ of each of its super-classes.
> 
>     meanwhile the above method works (or so I've read): create a class
> inheriting from the 2 metaclasses and use it as the metaclass of the
> inheriting
> class.

Hmm, interesting...

Phil


More information about the PyQt mailing list