
* examples/python/NetworkManager.py: Bug fixes to the code so we get all the device information that we need in get_device() * examples/python/NMTester.py: Fixed _print_device_list to print_device_list git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@107 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
45 lines
1.4 KiB
Python
Executable File
45 lines
1.4 KiB
Python
Executable File
#!/usr/bin/python
|
|
|
|
from NetworkManager import NetworkManager
|
|
import gtk
|
|
|
|
class NMTester(NetworkManager):
|
|
|
|
def __init__(self):
|
|
NetworkManager.__init__(self)
|
|
|
|
for signal in self.NM_SIGNALS:
|
|
self.nm_object.connect_to_signal(signal,
|
|
self.nm_signal_handler)
|
|
for signal in self.NMI_SIGNALS:
|
|
self.nmi_object.connect_to_signal(signal,
|
|
self.nmi_signal_handler)
|
|
self.print_device_list()
|
|
|
|
def print_device_list(self):
|
|
d_list = self.get_devices()
|
|
print
|
|
print "========================================================="
|
|
print
|
|
for d in d_list:
|
|
for k,v in d.iteritems():
|
|
print "%s: %s" % (k,v)
|
|
print
|
|
print "========================================================="
|
|
print
|
|
|
|
def nm_signal_handler(self, interface, signal_name,
|
|
service, path, message):
|
|
self.print_device_list()
|
|
|
|
def nmi_signal_handler(self, interface, signal_name,
|
|
service, path, message):
|
|
print ("Received signal '%s.%s' from object '%s%s' with message %s"
|
|
% (interface, signal_name, service, path, message))
|
|
|
|
if __name__ == "__main__":
|
|
nmt = NMTester()
|
|
gtk.main()
|
|
|
|
|