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

Marcos Dione mdione at grulic.org.ar
Thu Aug 13 16:12:52 BST 2009


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'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.

-- 
(Not so) Random fortune:
Tender is my heart / for screwing up my life
Lord I need to find / someone who can heal my mind
	    -- Blur, "Tender"


More information about the PyQt mailing list