dbus/python/examples/example-signals.py
Seth Nickell c5cf3857b1 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.
2003-09-26 10:27:59 +00:00

27 lines
712 B
Python

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()