Home | History | Annotate | Download | only in test-scripts
      1 #!/usr/bin/python
      2 
      3 import gobject
      4 
      5 import dbus
      6 import dbus.mainloop.glib
      7 
      8 def property_changed(name, value, path, interface):
      9     iface = interface[interface.rfind(".") + 1:]
     10     if name in ["Strength", "Priority"]:
     11         val = int(value)
     12     else:
     13         val = str(value)
     14     print "{%s} [%s] %s = %s" % (iface, path, name, val)
     15 
     16 if __name__ == '__main__':
     17     dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
     18 
     19     bus = dbus.SystemBus()
     20 
     21     bus.add_signal_receiver(property_changed,
     22                             bus_name="org.chromium.flimflam",
     23                             signal_name = "PropertyChanged",
     24                             path_keyword="path",
     25                             interface_keyword="interface")
     26 
     27     mainloop = gobject.MainLoop()
     28     mainloop.run()
     29