2004-07-11 03:02:14 +00:00
|
|
|
import dbus
|
|
|
|
|
import gtk
|
|
|
|
|
|
|
|
|
|
class TestObject(dbus.Object):
|
|
|
|
|
def __init__(self, service):
|
2005-04-25 22:54:28 +00:00
|
|
|
dbus.Object.__init__(self, "/org/designfu/TestService/object", service)
|
2004-07-11 03:02:14 +00:00
|
|
|
|
2005-04-25 22:54:28 +00:00
|
|
|
@dbus.signal('org.designfu.TestService')
|
|
|
|
|
def HelloSignal(self, message):
|
|
|
|
|
# The signal is emitted when this method exits
|
|
|
|
|
# You can have code here if you wish
|
|
|
|
|
pass
|
2004-07-11 03:02:14 +00:00
|
|
|
|
2005-04-25 22:54:28 +00:00
|
|
|
@dbus.method('org.designfu.TestService')
|
|
|
|
|
def emitHelloSignal(self):
|
|
|
|
|
#you emit signals by calling the signal's skeleton method
|
|
|
|
|
self.HelloSignal("Hello")
|
|
|
|
|
return "Signal emitted"
|
|
|
|
|
|
2004-07-11 03:02:14 +00:00
|
|
|
session_bus = dbus.SessionBus()
|
|
|
|
|
service = dbus.Service("org.designfu.TestService", bus=session_bus)
|
|
|
|
|
object = TestObject(service)
|
|
|
|
|
|
|
|
|
|
gtk.main()
|