summaryrefslogtreecommitdiffstats
path: root/python/examples/example-service.py
diff options
context:
space:
mode:
authorSeth Nickell <seth@gnome.org>2003-09-25 06:57:01 +0000
committerSeth Nickell <seth@gnome.org>2003-09-25 06:57:01 +0000
commit6f5fc71b10ab910612b7af767308f52bb8266b1e (patch)
treef43de9016ccfb2b69a021797260a8bc807d96eec /python/examples/example-service.py
parent31881de7dafad50446d2b0c8c0c96aa87a70ba61 (diff)
2003-09-24 Seth Nickell <seth@gnome.org>
* python/dbus.py: Connect Object methods (when you are sharing an object) up... pass in a list of methods to be shared. Sharing all the methods just worked out too weird. You can now create nice Services over the DBus in Python. :-) * python/dbus_bindings.pyx.in: Keep references to user_data tuples passed into C functions so Python doesn't garbage collect on us. Implement MethodReturn and Error subclasses of Message for creating DBusMessage's of those types. * python/examples/example-client.py: * python/examples/example-service.py: Simple example code showing both how create DBus services and objects, and how to use them.
Diffstat (limited to 'python/examples/example-service.py')
-rw-r--r--python/examples/example-service.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/python/examples/example-service.py b/python/examples/example-service.py
new file mode 100644
index 00000000..eb55af44
--- /dev/null
+++ b/python/examples/example-service.py
@@ -0,0 +1,16 @@
+import dbus
+
+import pygtk
+import gtk
+
+class MyObject(dbus.Object):
+ def __init__(self):
+ service = dbus.Service("org.designfu.SampleService")
+ dbus.Object("/MyObject", [self.HelloWorld], service)
+
+ def HelloWorld(self, arg1):
+ print ("Hello World!: %s" % (arg1))
+
+object = MyObject()
+
+gtk.main()