Search code examples
python-3.xpyqt5qdbus

What is wrong with this class? ( QDBusAbstractAdaptor )


I have the following class:

    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)        

It fails with the following errors:

$ 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 '')

The setter works well, so I have no idea what is wrong here.


Solution

  • I had a misunderstanding about the adaptor: Here there is an example which has helped me to understand how it works:

    http://permalink.gmane.org/gmane.comp.python.pyqt-pykde/24405