5 NMI
= 'org.freedesktop.NetworkManager'
7 class cNM(object.cObject
):
8 # TODO: pull them from introspection.xml
9 NM_STATE
= ["UNKNOWN", "ASLEEP", "CONNECTING", "CONNECTED", "DISCONNECTED",]
11 def __init__(self
, opath
, options
):
12 object.cObject
.__init
__(self
, opath
)
13 self
.nmi
= dbus
.Interface(self
.obj
, NMI
)
14 self
.options
= options
16 def get_property(self
, property_name
):
17 return object.cObject
.get_property(self
, NMI
, property_name
)
19 def set_property(self
, property_name
, value
):
20 return object.cObject
.set_property(self
, NMI
, property_name
, value
)
26 "Dumps its own info (not owned objects)."
32 for device
in self
.Devices():
35 if self
.options
.actcon
:
36 print "Active Connections"
37 aconns
= self
.ActiveConnections()
42 print "Wifi Networks:"
43 for dev
in self
.Devices():
46 def err_handler(self
, *args
):
49 def silent_handler(self
, *args
):
53 def quitter_handler(self
, *args
):
54 # exit the loop that runs only because of us
59 self
.bus
.add_signal_receiver(self
.state_changed_handler
,
60 dbus_interface
="org.freedesktop.NetworkManager",
61 signal_name
="StateChanged")
63 def state_changed_handler(self
, *args
):
66 print time
.strftime("(%X)"),