004-08-27 Bryan Clark <bclark@redhat.com>
* examples/python/systray/trayiconmodule.c: * examples/python/systray/trayicon.override: * examples/python/systray/network_tray.py: * examples/python/systray/eggtrayicon.h: * examples/python/systray/eggtrayicon.c: * examples/python/systray/Makefile: * examples/python/README: * examples/python/NetworkManager.py: * examples/python/NMTester.py: Initial commit of these python example files git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@93 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:

committed by
Bryan W. Clark

parent
7fd3e529b4
commit
591576fbc1
44
examples/python/NMTester.py
Executable file
44
examples/python/NMTester.py
Executable file
@@ -0,0 +1,44 @@
|
||||
#!/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()
|
||||
|
||||
|
Reference in New Issue
Block a user