mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2025-12-22 12:30:08 +01:00
* python/matchrules.py (SignalMatchRule, SignalMatchTree, SignalMatchNode): new classes that implement wildcard signal callback matching using a tree lookup. Heavily modified from a patch sent by Celso Pinto (fd.o bug #3241) * _dbus.py (add_signal_receiver, remove_signal_receiver, _signal_func): use new match classes to handle signals.
26 lines
737 B
Python
26 lines
737 B
Python
#!/usr/bin/env python
|
|
|
|
import dbus
|
|
import gtk
|
|
|
|
class TestObject(dbus.Object):
|
|
def __init__(self, service):
|
|
dbus.Object.__init__(self, "/org/designfu/TestService/object", service)
|
|
|
|
@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)
|
|
|
|
gtk.main()
|