dbus/python/examples/example-service.py
Seth Nickell d027c99375 2004-05-30 Seth Nickell <seth@gnome.org>
* python/dbus.py:

	Add a nicer-but-less-flexible alternate API for handling
	calls to virtual objects in dbus.ObjectTree.

	Screw up the argument order to the dbus.Object constructor
	for consistency with dbus.ObjectTree (and to make dbus_methods
	optional for future extension)

	* python/examples/Makefile.am:
	* python/examples/gconf-proxy-service.py:
	* python/examples/gconf-proxy-service2.py:

	Alternate implementation of gconf-proxy-service using the
	nicer dbus.ObjectTree API.

	* python/examples/example-service.py:
	* python/tests/test-server.py

	Reverse the argument order to deal with dbus.Object constructor
	changes.
2004-05-30 08:20:58 +00:00

18 lines
448 B
Python

import dbus
import pygtk
import gtk
class SomeObject(dbus.Object):
def __init__(self, service):
dbus.Object.__init__(self, "/SomeObject", service, [self.HelloWorld])
def HelloWorld(self, hello_message):
print (hello_message)
return ["Hello", "from example-service.py"]
session_bus = dbus.SessionBus()
service = dbus.Service("org.designfu.SampleService", bus=session_bus)
object = SomeObject(service)
gtk.main()