Re: [PyQt] QtDBus: Calling a method with an Array of Strings signature with Python 3
On 05/12/11 21:31, Phil Thompson wrote: On Mon, 05 Dec 2011 19:12:33 +, Chris Mayo cjm...@users.sourceforge.net wrote: Try this... arg = QDBusArgument() arg.beginArray(QMetaType.QString) arg.add() arg.endArray() and pass arg to call(). Doesn't seem to work: device_iface = QtDBus.QDBusInterface('org.freedesktop.UDisks', '/org/freedesktop/UDisks/devices/sr0', 'org.freedesktop.UDisks.Device', bus) arg = QtDBus.QDBusArgument() arg.beginArray(QMetaType.QString) arg.add() arg.endArray() reply = device_iface.call(DriveEject, arg) print(reply.errorMessage()) Returns: Unknown option because is not a valid option? According to... http://hal.freedesktop.org/docs/udisks/Device.html#Device.DriveEject unmount is the only valid option. Phil Indeed it does work as: arg = QtDBus.QDBusArgument() arg.beginArray(QMetaType.QString) arg.add(unmount) arg.endArray() and so does: arg = QtDBus.QDBusArgument() arg.beginArray(QMetaType.QString) arg.endArray() Experimenting with other calls shows this is the way to create an empty Array of Strings. Chris ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] QtDBus: Calling a method with an Array of Strings signature with Python 3
On Tue, 06 Dec 2011 17:43:36 +, Chris Mayo cjm...@users.sourceforge.net wrote: On 05/12/11 21:31, Phil Thompson wrote: On Mon, 05 Dec 2011 19:12:33 +, Chris Mayo cjm...@users.sourceforge.net wrote: Try this... arg = QDBusArgument() arg.beginArray(QMetaType.QString) arg.add() arg.endArray() and pass arg to call(). Doesn't seem to work: device_iface = QtDBus.QDBusInterface('org.freedesktop.UDisks', '/org/freedesktop/UDisks/devices/sr0', 'org.freedesktop.UDisks.Device', bus) arg = QtDBus.QDBusArgument() arg.beginArray(QMetaType.QString) arg.add() arg.endArray() reply = device_iface.call(DriveEject, arg) print(reply.errorMessage()) Returns: Unknown option because is not a valid option? According to... http://hal.freedesktop.org/docs/udisks/Device.html#Device.DriveEject unmount is the only valid option. Phil Indeed it does work as: arg = QtDBus.QDBusArgument() arg.beginArray(QMetaType.QString) arg.add(unmount) arg.endArray() and so does: arg = QtDBus.QDBusArgument() arg.beginArray(QMetaType.QString) arg.endArray() Experimenting with other calls shows this is the way to create an empty Array of Strings. The current snapshot also allows... arg = QDBusArgument([], QMetaType.QStringList) Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] QtDBus: Calling a method with an Array of Strings signature with Python 3
On Sun, 04 Dec 2011 20:17:52 +, Chris Mayo cjm...@users.sourceforge.net wrote: With Python 2 I can do (where /dev/sr0 is a cdrom): bus = QtDBus.QDBusConnection.systemBus() device_iface = QtDBus.QDBusInterface('org.freedesktop.UDisks', '/org/freedesktop/UDisks/devices/sr0', 'org.freedesktop.UDisks.Device', bus) reply = device_iface.call(DriveEject, QStringList()) But with Python 3 this won't work because of QStringList. If I modify it with: reply = device_iface.call(DriveEject, [, ]) print(reply.errorMessage()) I get: Method DriveEject with signature av on interface org.freedesktop.UDisks.Device doesn't exist Chris PyQt-x11-gpl-snapshot-4.9-65564eb2fcf4 Try this... arg = QDBusArgument() arg.beginArray(QMetaType.QString) arg.add() arg.endArray() ...and pass arg to call(). If that works I'll change QDBusArgument so that you can do... call(DeviceEject, QDBusArgument([], QMetaType.QStringList)) Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] QtDBus: Calling a method with an Array of Strings signature with Python 3
Try this... arg = QDBusArgument() arg.beginArray(QMetaType.QString) arg.add() arg.endArray() and pass arg to call(). Doesn't seem to work: device_iface = QtDBus.QDBusInterface('org.freedesktop.UDisks', '/org/freedesktop/UDisks/devices/sr0', 'org.freedesktop.UDisks.Device', bus) arg = QtDBus.QDBusArgument() arg.beginArray(QMetaType.QString) arg.add() arg.endArray() reply = device_iface.call(DriveEject, arg) print(reply.errorMessage()) Returns: Unknown option PyQt-x11-gpl-snapshot-4.9-512e7813ed74 Chris ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] QtDBus: Calling a method with an Array of Strings signature with Python 3
On Mon, 05 Dec 2011 19:12:33 +, Chris Mayo cjm...@users.sourceforge.net wrote: Try this... arg = QDBusArgument() arg.beginArray(QMetaType.QString) arg.add() arg.endArray() and pass arg to call(). Doesn't seem to work: device_iface = QtDBus.QDBusInterface('org.freedesktop.UDisks', '/org/freedesktop/UDisks/devices/sr0', 'org.freedesktop.UDisks.Device', bus) arg = QtDBus.QDBusArgument() arg.beginArray(QMetaType.QString) arg.add() arg.endArray() reply = device_iface.call(DriveEject, arg) print(reply.errorMessage()) Returns: Unknown option ...because is not a valid option? According to... http://hal.freedesktop.org/docs/udisks/Device.html#Device.DriveEject ...unmount is the only valid option. Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] QtDBus: Calling a method with an Array of Strings signature with Python 3
With Python 2 I can do (where /dev/sr0 is a cdrom): bus = QtDBus.QDBusConnection.systemBus() device_iface = QtDBus.QDBusInterface('org.freedesktop.UDisks', '/org/freedesktop/UDisks/devices/sr0', 'org.freedesktop.UDisks.Device', bus) reply = device_iface.call(DriveEject, QStringList()) But with Python 3 this won't work because of QStringList. If I modify it with: reply = device_iface.call(DriveEject, [, ]) print(reply.errorMessage()) I get: Method DriveEject with signature av on interface org.freedesktop.UDisks.Device doesn't exist Chris PyQt-x11-gpl-snapshot-4.9-65564eb2fcf4 ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt