我有以下类:
class DBusAdaptor(QDBusAbstractAdaptor):
Q_CLASSINFO("D-Bus Interface", 'org.kde.kdialog.ProgressDialog')
Q_CLASSINFO("D-Bus Introspection", '''<interface name="org.kde.kdialog.ProgressDialog">
<property name="maximum" type="i" access="readwrite"/>
<method name="close"/>
</interface>''')
def __init__(self, parent):
super(DBusAdaptor, self).__init__(parent)
self.parent = parent
@pyqtSlot()
def close(self):
self.parent.close()
@pyqtProperty(int)
def maximum(self): # BUG: No such method 'maximum' in any interface at object path '/ProgressDialog' (signature '')
return self.parent.progressBar.maximum()
@maximum.setter
def maximum(self, maximum):
self.parent.progressBar.setMaximum(maximum)
它因以下错误而失败:
$ qdbus org.kde.kdialog-15070 /ProgressDialog maximum
Error: org.freedesktop.DBus.Error.UnknownMethod
No such method 'maximum' in any interface at object path '/ProgressDialog' (signature '')
二传手打得很好,所以我不知道这里出了什么问题。
我对适配器有一个误解:这里有一个例子帮助我理解了它的工作原理:
http://permalink.gmane.org/gmane.comp.python.pyqt-pykde/24405