mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2025-12-24 14:40:09 +01:00
* 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.
16 lines
323 B
Python
16 lines
323 B
Python
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()
|