diff options
author | Huang Peng <shawn.p.huang@gmail.com> | 2008-07-14 13:59:53 +0100 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2008-07-14 14:02:12 +0100 |
commit | 6412e09f3140f6496acf29dae0fcd1c75d517c74 (patch) | |
tree | 0f59bebc2e0e7ea1614d7dfae88afabc471121de /examples/dbusserver/client.py | |
parent | d84397b0a99f06141f34b13e9965dcab1d311e6a (diff) | |
download | dbus-python-huangpeng-dbusserver-monolithic.tar.gz |
Demo code for Server APIshuangpeng-dbusserver-monolithic
Diffstat (limited to 'examples/dbusserver/client.py')
-rwxr-xr-x | examples/dbusserver/client.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/examples/dbusserver/client.py b/examples/dbusserver/client.py new file mode 100755 index 0000000..ad92f43 --- /dev/null +++ b/examples/dbusserver/client.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python +import dbus +import dbus.mainloop.glib +import os +import gobject +import time + + +def main(): + loop = gobject.MainLoop () + bus = dbus.SessionBus () + obj = bus.get_object ("org.freedesktop.DBus", "/org/freedesktop/DBus") + while True: + print obj.HelloWorld ("[%s][%s]" % (time.time(), bus.get_unique_name())) + time.sleep (1) + loop.run () + +if __name__ == "__main__": + os.environ["DBUS_SESSION_BUS_ADDRESS"]="unix:abstract=/tmp/ibus" + dbus.mainloop.glib.DBusGMainLoop (set_as_default=True) + main () |