2003-09-30 02:41:13 +00:00
|
|
|
import dbus
|
|
|
|
|
|
|
|
|
|
import pygtk
|
|
|
|
|
import gtk
|
|
|
|
|
|
|
|
|
|
class SomeObject(dbus.Object):
|
|
|
|
|
def __init__(self, service):
|
2005-04-25 22:54:28 +00:00
|
|
|
dbus.Object.__init__(self, "/SomeObject", service)
|
2003-09-30 02:41:13 +00:00
|
|
|
|
2005-04-25 22:54:28 +00:00
|
|
|
@dbus.method("org.designfu.SampleInterface")
|
|
|
|
|
def HelloWorld(self, hello_message):
|
2005-01-28 19:09:55 +00:00
|
|
|
print (str(hello_message))
|
|
|
|
|
return ["Hello", " from example-service.py"]
|
2003-09-30 02:41:13 +00:00
|
|
|
|
2005-04-25 22:54:28 +00:00
|
|
|
@dbus.method("org.designfu.SampleInterface")
|
|
|
|
|
def GetTuple(self):
|
2005-02-11 19:51:18 +00:00
|
|
|
return ("Hello Tuple", " from example-service.py")
|
|
|
|
|
|
2005-04-25 22:54:28 +00:00
|
|
|
@dbus.method("org.designfu.SampleInterface")
|
|
|
|
|
def GetDict(self):
|
2005-02-11 19:51:18 +00:00
|
|
|
return {"first": "Hello Dict", "second": " from example-service.py"}
|
|
|
|
|
|
2004-05-29 22:37:13 +00:00
|
|
|
session_bus = dbus.SessionBus()
|
|
|
|
|
service = dbus.Service("org.designfu.SampleService", bus=session_bus)
|
2003-09-30 02:41:13 +00:00
|
|
|
object = SomeObject(service)
|
|
|
|
|
|
|
|
|
|
gtk.main()
|