[PyQt] inheriting from QObject and dbus.service.Object
phil at riverbankcomputing.com
Tue Aug 11 09:21:37 BST 2009
On Tue, 11 Aug 2009 07:54:35 +0200, Marcos Dione <mdione at grulic.org.ar>
> I'm trying to export some class' methods via DBus. this class is already
> subclass of QObject, so I thought that simply adding inheritance on
> dbus.service.Object would work. but it doesn't; I get this error:
> In : import dbus.service
> In : from PyQt4.QtCore import QObject
> In : class A (dbus.service.Object, QObject): pass
> TypeError: Error when calling the metaclass bases
> metaclass conflict: the metaclass of a derived class must be a
> subclass of the metaclasses of all its bases
> I tried figuring out which are the metaclasses. it was easy for
> dbus.service.Object, but no cigar with QObject:
> In : dbus.service.Object.__metaclass__
> Out: <class 'dbus.service.InterfaceType'>
> In : QObject.__metaclass__
> AttributeError: type object 'QObject' has no attribute '__metaclass__'
> is it possible to inherit from both? or will I have to make another
> for this?
You can't inherit from both for the reason given. I don't know enough about
DBus to know what the best solution is.
More information about the PyQt