I seem to have fixed the bug I mentioned in my last post. This is what I had:
class MetaPlayer (type (QObject), type (dbus.service.Object)):
"""Dummy metaclass that allows us to inherit from both QObject and
d.s.Object"""
pass
class Player (QObject, dbus.service.Object):
__metaclass__= MetaPlayer
[...]
Notice that MetaPlayer doesn't have a explicit
__init__() method; one would spect that Python would
take are of that. Here's the fixing code:
MetaQObject= type (QObject)
MetaObject= type (dbus.service.Object)
class MetaPlayer (MetaQObject, MetaObject):
"""Dummy metaclass that allows us to inherit from both QObject and d.s.Object"""
def __init__(cls, name, bases, dct):
MetaObject.__init__ (cls, name, bases, dct)
MetaQObject.__init__ (cls, name, bases, dct)
I really don't understand why I have to be so explicit. Maybe
it's because the metaclass for dbus.service.Object,
dbus.service.InterfaceType, inherits from the
type type[1]; this type is a new style class[2], but
doesn't inherits from object. Thus, I think, the
inherited __init__() methods are not called
automatically.
In any case, now I can mix QObject and
dbus.service.Object, and it works fine. For instance,
this call works:
$ qdbus org.kde.satyr /player quit
[1] the type type is of type type!
here:
In [1]: type (type)
Out[1]: <type 'type'>
[2] its type is not instance but type,
as mentioned above.