[PyQt] How to expose function accepting array of struct to D-Bus?

Evade Flow evadeflow at gmail.com
Thu Aug 9 18:14:29 BST 2012


Oops--nevermind about that SO post. I removed it after realizing that
the Chat Demo I originally posted does not, in fact, export any
functions accepting an *array* of struct.  After modifying it (in a
slightly contrived way) so that it does, the dbus-python script to
invoke it works fine.

If anyone is interested, you can find the complete C++ example here:

  - http://github.com/evadeflow/chat-demo

What I desperately want to know is: how can I write the exact same demo
in PyQt4---including the sendMessages() method?  Is it possible?


On Thu, Aug 9, 2012 at 12:06 PM, Evade Flow <evadeflow at gmail.com> wrote:
> While attempting to put together a test case for this array-of-struct
> difficulty I'm having, I discovered that I can't even talk to most of
> these (C++/Qt) services using the standard dbus-python module. For any
> method that takes an array-of-struct, I always get 'No such method'
> errors.
>
> Since this isn't PyQt-specific, I posted a question to stackoverflow.com
> (see http://is.gd/dyhcNh). However, I figured some folks on this list
> might be interested, or might know why a Qt-based D-Bus service that
> exports methods with array-of-struct in their signature are (seemingly)
> so darn difficult to invoke from Python! `:-}
>
>
> On Tue, Aug 7, 2012 at 4:25 PM, Phil Thompson
> <phil at riverbankcomputing.com> wrote:
>> On Tue, 7 Aug 2012 15:45:43 -0400, Evade Flow <evadeflow at gmail.com> wrote:
>>>> In theory you should be able to use QDBusArgument but I've not tested
>>>> it - I've always struggled to find test cases.
>>
>>>     @pyqtSlot(QDBusArgument)
>>>     def setPosition(self, pos):
>>>         print("How can I call this function?")
>>
>> If you change this to...
>>
>>     @pyqtSlot(float, float, float)
>>     def setPosition(self, pos0, pos1, pos2):
>>         print("How can I call this function?", pos0, pos1, pos2)
>>
>> ...then it works. So is the test case still valid?
>>
>> Phil


More information about the PyQt mailing list