On Mon, 13 Aug 2012 11:13:36 -0400, Evade Flow <evadef...@gmail.com> wrote: >> Sorry, my mistake - QDBusPendingReply, not QPyDBusPendingReply... > > Ah, okay---yeah, that works great, thanks! I had a couple minor typos in > my example. Appending a complete, working version below, in case it's > helpful to someone else (possibly a future version of me! :-}) It should > work on most current Linux distributions, though you might need to > replace 'sda1' with a different partition name... > > ---------- > > from PyQt4 import QtCore, QtDBus > > class DeviceInterface(QtDBus.QDBusAbstractInterface): > > def __init__(self, service, path, connection, parent=None): > super().__init__(service, path, 'org.freedesktop.UDisks.Device', > connection, parent) > > @QtCore.pyqtSlot(QtDBus.QDBusArgument) > def callFinishedSlot(self, call): > reply = QtDBus.QDBusPendingReply(call) > if reply.isError(): > print(reply.error().message()) > else: > print(" PID UID COMMAND") > print("------- ------- > ------------------------------------") > for pid, uid, cmd in reply.argumentAt(0): > print("{0:>7d} {1:>7d} {2}".format(pid, uid, cmd)) > > if __name__ == '__main__': > import sys > app = QtCore.QCoreApplication(sys.argv) > > dev = DeviceInterface('org.freedesktop.UDisks', > '/org/freedesktop/UDisks/devices/sda1', > QtDBus.QDBusConnection.systemBus(), app) > > async = dev.asyncCall("FilesystemListOpenFiles"); > watcher = QtDBus.QDBusPendingCallWatcher(async, dev) > watcher.finished.connect(dev.callFinishedSlot) > sys.exit(app.exec_())
Actually there is still a bug. Change the call to pyqtSlot() to... @QtCore.pyqtSlot(QtDBus.QDBusPendingCall) ...or just remove it completely. Phil _______________________________________________ PyQt mailing list PyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt