diff options
author | Seth Nickell <seth@gnome.org> | 2003-09-26 10:27:59 +0000 |
---|---|---|
committer | Seth Nickell <seth@gnome.org> | 2003-09-26 10:27:59 +0000 |
commit | c5cf3857b114d0008a6d8191abf389064b5a66fc (patch) | |
tree | e89751f02010ba858424769d2cb9f501ea51099c /python/examples | |
parent | 9f2ff915a181585ddeaca079a7cfe057d10a3aed (diff) | |
download | dbus-c5cf3857b114d0008a6d8191abf389064b5a66fc.tar.gz |
2003-09-26 Seth Nickell <seth@gnome.org>
* 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.
Diffstat (limited to 'python/examples')
-rw-r--r-- | python/examples/example-signals.py | 27 |
1 files changed, 27 insertions, 0 deletions
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() + + |