diff options
Diffstat (limited to 'python/examples/example-signal-emitter.py')
-rw-r--r-- | python/examples/example-signal-emitter.py | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/python/examples/example-signal-emitter.py b/python/examples/example-signal-emitter.py index bcd5ad6f..8797e5f6 100644 --- a/python/examples/example-signal-emitter.py +++ b/python/examples/example-signal-emitter.py @@ -3,13 +3,20 @@ import gtk class TestObject(dbus.Object): def __init__(self, service): - dbus.Object.__init__(self, "/org/designfu/TestService/object", service, [self.emitHelloSignal]) + dbus.Object.__init__(self, "/org/designfu/TestService/object", service) - def emitHelloSignal(self, message): - # Emit the signal - self.emit_signal(interface="org.designfu.TestService", - signal_name="hello") + @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 + @dbus.method('org.designfu.TestService') + def emitHelloSignal(self): + #you emit signals by calling the signal's skeleton method + self.HelloSignal("Hello") + return "Signal emitted" + session_bus = dbus.SessionBus() service = dbus.Service("org.designfu.TestService", bus=session_bus) object = TestObject(service) |