我有以下课程:
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 '')
setter效果很好,所以我不知道这里有什么问题。
答案 0 :(得分:0)
我对适配器有误解:这里有一个例子可以帮助我理解它是如何工作的:
http://permalink.gmane.org/gmane.comp.python.pyqt-pykde/24405