dbus/python/examples/example-signal-emitter.py
John (J5) Palmieri 2c413bf281 * python/.cvsignore: remove dbus_bindings.pyx, add dbus_bindings.pxd
* python/service.py (class Name): renamed BusName to make it clearer
  what the object is for (a name on the bus)

* python/examples/example-service.py,
  python/examples/example-signal-emitter.py: change the Name object to
  BusName
2005-07-13 18:22:35 +00:00

27 lines
785 B
Python

#!/usr/bin/env python
import dbus
import dbus.service
import gtk
class TestObject(dbus.service.Object):
def __init__(self, name):
dbus.service.Object.__init__(self, "/org/designfu/TestService/object", name)
@dbus.service.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.service.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()
name = dbus.service.BusName("org.designfu.TestService", bus=session_bus)
object = TestObject(name)
gtk.main()