mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2025-12-25 10:30:10 +01:00
* 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
27 lines
785 B
Python
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()
|