From c5cf3857b114d0008a6d8191abf389064b5a66fc Mon Sep 17 00:00:00 2001 From: Seth Nickell Date: Fri, 26 Sep 2003 10:27:59 +0000 Subject: 2003-09-26 Seth Nickell * python/dbus.py: * python/examples/example-signals.py: Start implementing some notions of signals. The API is really terrible, but they sort of work (with the exception of being able to filter by service, and to transmit signals *as* a particular service). Need to figure out how to make messages come from the service we registered :-( * python/dbus_bindings.pyx.in: Removed duplicate message_handler callbacks. --- python/examples/example-signals.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 python/examples/example-signals.py (limited to 'python/examples/example-signals.py') diff --git a/python/examples/example-signals.py b/python/examples/example-signals.py new file mode 100644 index 00000000..8e319569 --- /dev/null +++ b/python/examples/example-signals.py @@ -0,0 +1,27 @@ +import pygtk +import gtk + +import dbus + +class SignalFrom(dbus.Object): + def __init__(self, service): + dbus.Object.__init__(self, "/", [], service) + +def signal_to(interface, signal_name, service, path): + print ("Received signal '%s.%s' from '%s%s'" % (interface, signal_name, service, path)) + +bus = dbus.Bus() +bus.add_signal_receiver(signal_to, + "org.designfu.SignalInterface", + "org.designfu.SignalService", + "/") + + +service = dbus.Service("org.designfu.SignalService", bus) +signal_from = SignalFrom(service) + +signal_from.broadcast_signal("org.designfu.SignalInterface", "HelloWorld") + +gtk.main() + + -- cgit