1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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()
|