[PYDBUS]Export method question

Claudio Takahasi cktakahasi at gmail.com
Fri Oct 28 11:01:46 PDT 2005


Hi folks,

I am newbie on python and pydbus. Sorry if I ask a simple question,
but I was not able to solve this problem. I need to export a method to
get a password.

The UI was developed using pygtk. How can I integrate UI callbacks
with the D-Bus service?
When I send a method call "PwdRequest" the application is started
automatically, however I CAN'T reply immediately because the reply
content is not available.  The reply data(password) will become
available only when the user presses the button(OK). How can I design
it?

The pseudo code is here:

 class CDBusPwdAgent(dbus.service.Object):

	...
         @dbus.service.method('org.test')
         def PwdRequest(self):
                 print "PWD Request received"
                 return ??? # I can't return immediately!!!
   ...
 class CPwdUI:
         # Our callback.
         # The data passed to this method is printed to stdout
         def ok_callback(self, widget, data=None):
                 print "OK was pressed"
...



Example of a client call:
dbus-send --session --type=method_call --print-reply=literal
--dest=org.test /org/test org.test.PwdRequest


Thanks in advance,
Claudio


More information about the dbus mailing list