From 43d6acfc4717c8f139f2dcffbbb7c98d9705888f Mon Sep 17 00:00:00 2001 From: Adam Blackburn Date: Tue, 23 Dec 2008 11:39:55 -0600 Subject: [PATCH 1/6] Updated Preferences dialog and added test cases for wnettools --- data/wicd.glade | 1090 ++++++++++++++++++++-------------------- setup.py | 21 +- tests/__init__.py | 9 + tests/testwnettools.py | 66 +++ wicd/wicd-client.py | 3 +- 5 files changed, 641 insertions(+), 548 deletions(-) create mode 100644 tests/__init__.py create mode 100644 tests/testwnettools.py diff --git a/data/wicd.glade b/data/wicd.glade index 7aa264e..234fd4a 100644 --- a/data/wicd.glade +++ b/data/wicd.glade @@ -1,6 +1,6 @@ - + 450 @@ -429,14 +429,15 @@ 4 4 - + True - 12 + 24 - + True True - Automatically reconnect on wireless network connection loss + If enabled, the wired network interface will always be displayed in the main window. This can be useful if your wired network card does not detect when the interface is connected to a cable. + Always show wired interface 0 True @@ -444,67 +445,255 @@ 2 - 15 - 16 + 3 + 4 - + + True + True + + + 1 + 2 + 6 + 7 + + + + + + True + True + + + 1 + 2 + 7 + 8 + + + + + + True + True + + + 1 + 2 + 8 + 9 + + + + + True 0 - <b>Wireless automatic connection</b> + <b>Global DNS Servers</b> True 2 - 14 - 15 + 4 + 5 - + True 12 - + True True - Use last wired network profile + Use global DNS servers 0 - True True 2 - 13 - 14 + 5 + 6 - + True - 12 + 24 - + True - True - Prompt for wired network profile - 0 - True - True - pref_use_last_radio + 0 + Search domain: + 6 + 7 + + + + + + True + 24 + + + True + 0 + DNS server 1: + + + + + 7 + 8 + + + + + + True + 24 + + + True + 0 + DNS server 2: + + + + + 8 + 9 + + + + + + True + True + + + 1 2 - 12 - 13 + 9 + 10 + + + + + + True + 24 + + + True + 0 + DNS server 3: + + + + + 9 + 10 + + + + + + True + 0 + <b>Network Interfaces</b> + True + + + 2 + + + + + + True + True + + + 1 + 2 + 1 + 2 + + + + + + True + True + + + 1 + 2 + 2 + 3 + + + + + + True + 12 + + + True + 0 + Wireless interface: + + + + + 1 + 2 + + + + + + True + 12 + + + True + 0 + Wired interface: + + + + + 2 + 3 + + + + + + True + 0 + <b>Wired automatic connection</b> + True + + + 2 + 10 + 11 @@ -532,187 +721,73 @@ - - True - 0 - <b>Wired automatic connection</b> - True - - - 2 - 10 - 11 - - - - - + True 12 - - True - 0 - Wired interface: - - - - - 2 - 3 - - - - - - True - 12 - - - True - 0 - Wireless interface: - - - - - 1 - 2 - - - - - - True - True - - - 1 - 2 - 2 - 3 - - - - - - True - True - - - 1 - 2 - 1 - 2 - - - - - - True - 0 - <b>Network Interfaces</b> - True - - - 2 - - - - - - True - 24 - - - True - 0 - DNS server 3: - - - - - 9 - 10 - - - - - - True - True - - - 1 - 2 - 9 - 10 - - - - - - True - 24 - - - True - 0 - DNS server 2: - - - - - 8 - 9 - - - - - - True - 24 - - - True - 0 - DNS server 1: - - - - - 7 - 8 - - - - - - True - 24 - - - True - 0 - Search domain: - - - - - 6 - 7 - - - - - - True - 12 - - + True True - Use global DNS servers + Prompt for wired network profile + 0 + True + True + pref_use_last_radio + + + + + 2 + 12 + 13 + + + + + + True + 12 + + + True + True + Use last wired network profile + 0 + True + True + + + + + 2 + 13 + 14 + + + + + + True + 0 + <b>Wireless automatic connection</b> + True + + + 2 + 14 + 15 + + + + + + True + 12 + + + True + True + Automatically connect to on network connection loss 0 True @@ -720,83 +795,8 @@ 2 - 5 - 6 - - - - - - True - 0 - <b>Global DNS Servers</b> - True - - - 2 - 4 - 5 - - - - - - True - True - - - 1 - 2 - 8 - 9 - - - - - - True - True - - - 1 - 2 - 7 - 8 - - - - - - True - True - - - 1 - 2 - 6 - 7 - - - - - - True - 24 - - - True - True - If enabled, the wired network interface will always be displayed in the main window. This can be useful if your wired network card does not detect when the interface is connected to a cable. - Always show wired interface - 0 - True - - - - - 2 - 3 - 4 + 15 + 16 @@ -841,146 +841,13 @@ True 6 - + True 0 - <b>Route Table Flushing</b> + <b>DHCP Client</b> True - 4 - 5 - - - - - - True - 0 - <b>Wired Link Detection</b> - True - - - 2 - 3 - - - - - - True - 12 - - - True - - - True - True - Automatic (recommended) - 0 - True - True - - - False - - - - - True - True - ip - 0 - True - True - flush_auto_radio - - - False - 1 - - - - - True - True - route - 0 - True - True - flush_auto_radio - - - False - 2 - - - - - - - 5 - 6 - - - - - - True - 12 - - - True - - - True - True - Automatic (recommended) - 0 - True - True - - - False - - - - - True - True - ethtool - 0 - True - True - link_auto_radio - - - False - 1 - - - - - True - True - mii-tool - 0 - True - True - link_auto_radio - - - False - 2 - - - - - - - 3 - 4 @@ -1059,13 +926,146 @@ - + + True + 12 + + + True + + + True + True + Automatic (recommended) + 0 + True + True + + + False + + + + + True + True + ethtool + 0 + True + True + link_auto_radio + + + False + 1 + + + + + True + True + mii-tool + 0 + True + True + link_auto_radio + + + False + 2 + + + + + + + 3 + 4 + + + + + + True + 12 + + + True + + + True + True + Automatic (recommended) + 0 + True + True + + + False + + + + + True + True + ip + 0 + True + True + flush_auto_radio + + + False + 1 + + + + + True + True + route + 0 + True + True + flush_auto_radio + + + False + 2 + + + + + + + 5 + 6 + + + + + True 0 - <b>DHCP Client</b> + <b>Wired Link Detection</b> True + 2 + 3 + + + + + + True + 0 + <b>Route Table Flushing</b> + True + + + 4 + 5 @@ -1104,41 +1104,131 @@ 9 2 - + + True + + + 2 + 3 + + + + + + True + 0 + You should almost always use wext as the WPA supplicant driver. + True + + + 1 + 2 + 2 + 3 + + + + + True - 12 - + True - 0 - Driver: + + False + + 1 + 2 1 2 - + + True + 0 + <b>Backend</b> + True + + + 2 + 3 + 4 + + + + + + True + + + 1 + 2 + 4 + 5 + + + + + True 12 - + True - True - Use dBm to measure signal strength - 0 - True + 0 + Backend: + + 4 + 5 + + + + + + True + 0 + <b>Debugging</b> + True + 2 - 8 - 9 + 5 + 6 + + + + + + True + 0 + <b>WPA Supplicant</b> + True + + + 2 + + + + + + True + 0 + <b>Wireless Interface</b> + True + + + 2 + 7 + 8 @@ -1164,134 +1254,44 @@ - - True - 0 - <b>Wireless Interface</b> - True - - - 2 - 7 - 8 - - - - - - True - 0 - <b>WPA Supplicant</b> - True - - - 2 - - - - - - True - 0 - <b>Debugging</b> - True - - - 2 - 5 - 6 - - - - - + True 12 - + + True + True + Use dBm to measure signal strength + 0 + True + + + + + 2 + 8 + 9 + + + + + + True + 12 + + True 0 - Backend: + Driver: - 4 - 5 - - - - - - True - - - 1 - 2 - 4 - 5 - - - - - - True - 0 - <b>Backend</b> - True - - - 2 - 3 - 4 - - - - - - True - - - True - - - False - - - - - 1 - 2 1 2 - - - True - 0 - You should almost always use wext as the WPA supplicant driver. - True - - - 1 - 2 - 2 - 3 - - - - - - True - - - 2 - 3 - - - diff --git a/setup.py b/setup.py index 521e7dd..16644e5 100755 --- a/setup.py +++ b/setup.py @@ -219,7 +219,24 @@ class configure(Command): item_out.close() item_in.close() shutil.copymode(original_name, final_name) + +class test(Command): + description = "run Wicd's unit tests" + + user_options = [] + + def initialize_options(self): + pass + def finalize_options(self): + pass + + def run(self): + print "importing tests" + import tests + print 'running tests' + tests.run_tests() + class get_translations(Command): description = "download the translations from the online translator" @@ -330,7 +347,7 @@ try: data.append(( wpath.suspend, ['other/50-wicd-suspend.sh' ])) if not wpath.no_install_pmutils: data.append(( wpath.pmutils, ['other/55wicd' ])) - print 'Creating pid path', os.path.basename(wpath.pidfile) + print 'Using pid path', os.path.basename(wpath.pidfile) print 'Language support for', for language in os.listdir('translations/'): if not language.startswith('.'): @@ -354,7 +371,7 @@ iwscan_ext = Extension(name = 'iwscan', libraries = ['iw'], sources = ['depends/python-iwscan/pyiwscan.c']) -setup(cmdclass={'configure' : configure, 'get_translations' : get_translations, 'uninstall' : uninstall}, +setup(cmdclass={'configure' : configure, 'get_translations' : get_translations, 'uninstall' : uninstall, 'test' : test}, name="Wicd", version=VERSION_NUM, description="A wireless and wired network manager", diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..369c462 --- /dev/null +++ b/tests/__init__.py @@ -0,0 +1,9 @@ + +def run_tests(): + import unittest + test_suite = unittest.TestSuite() + + import testwnettools + test_suite.addTest(testwnettools.suite()) + + unittest.TextTestRunner(verbosity=5).run(test_suite) diff --git a/tests/testwnettools.py b/tests/testwnettools.py new file mode 100644 index 0000000..2ace308 --- /dev/null +++ b/tests/testwnettools.py @@ -0,0 +1,66 @@ +import unittest +from wicd import wnettools + +class TestWnettools(unittest.TestCase): + def setUp(self): + self.interface = wnettools.BaseInterface('eth0') + + def test_find_wireless_interface(self): + interfaces = wnettools.GetWirelessInterfaces() + # wlan0 may change depending on your system + self.assertTrue('wlan0' in interfaces) + + def test_find_wired_interface(self): + interfaces = wnettools.GetWiredInterfaces() + # eth0 may change depending on your system + self.assertTrue('eth0' in interfaces) + + def test_wext_is_valid_wpasupplicant_driver(self): + self.assertTrue(wnettools.IsValidWpaSuppDriver('wext')) + + def test_needs_external_calls_not_implemented(self): + self.assertRaises(NotImplementedError, wnettools.NeedsExternalCalls) + + def test_get_ip_not_implemented(self): + self.assertRaises(NotImplementedError, self.interface.GetIP) + + def test_is_up_not_implemented(self): + self.assertRaises(NotImplementedError, self.interface.IsUp) + + def test_enable_debug_mode(self): + self.interface.SetDebugMode(True) + self.assertTrue(self.interface.verbose) + + def test_disable_debug_mode(self): + self.interface.SetDebugMode(False) + self.assertFalse(self.interface.verbose) + + def test_interface_name_sanitation(self): + interface = wnettools.BaseInterface('blahblah; uptime > /tmp/blah | cat') + self.assertEquals(interface.iface, 'blahblahuptimetmpblahcat') + + def test_freq_translation_low(self): + freq = '2.412 GHz' + interface = wnettools.BaseWirelessInterface('wlan0') + self.assertEquals(interface._FreqToChannel(freq), 1) + + def test_freq_translation_high(self): + freq = '2.484 GHz' + interface = wnettools.BaseWirelessInterface('wlan0') + self.assertEquals(interface._FreqToChannel(freq), 14) + + def test_generate_psk(self): + interface = wnettools.BaseWirelessInterface('wlan0') + psk = interface.GeneratePSK({'essid' : 'Network 1', 'key' : 'arandompassphrase'}) + self.assertEquals(psk, 'd70463014514f4b4ebb8e3aebbdec13f4437ac3a9af084b3433f3710e658a7be') + +def suite(): + suite = unittest.TestSuite() + tests = [] + [ tests.append(test) for test in dir(TestWnettools) if test.startswith('test') ] + for test in tests: + suite.addTest(TestWnettools(test)) + return suite + +if __name__ == '__main__': + unittest.main() diff --git a/wicd/wicd-client.py b/wicd/wicd-client.py index 40114de..743b9e8 100755 --- a/wicd/wicd-client.py +++ b/wicd/wicd-client.py @@ -364,7 +364,8 @@ class TrayIcon(object): if DBUS_AVAIL: self.toggle_wicd_gui() else: - gui.error(None, language["daemon_unavailable"]) + # gui.error(None, language["daemon_unavailable"]) + pass def on_quit(self, widget=None): """ Closes the tray icon. """ From d4a0b8d366c814fd67e659cb4f017f76c3d53096 Mon Sep 17 00:00:00 2001 From: Adam Blackburn Date: Tue, 23 Dec 2008 16:55:15 -0600 Subject: [PATCH 2/6] Added the wpa-psk template and change the wpa one to wpa passphrase --- encryption/templates/active | 1 + encryption/templates/wpa | 2 +- encryption/templates/wpa-psk | 15 +++++++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 encryption/templates/wpa-psk diff --git a/encryption/templates/active b/encryption/templates/active index 3be3271..aee3d84 100644 --- a/encryption/templates/active +++ b/encryption/templates/active @@ -1,4 +1,5 @@ wpa +wpa-psk wep-hex wep-passphrase wep-shared diff --git a/encryption/templates/wpa b/encryption/templates/wpa index c618bcb..20b36a7 100644 --- a/encryption/templates/wpa +++ b/encryption/templates/wpa @@ -1,4 +1,4 @@ -name = WPA 1/2 +name = WPA 1/2 (Passphrase) author = Adam Blackburn version = 1 require key *Key diff --git a/encryption/templates/wpa-psk b/encryption/templates/wpa-psk new file mode 100644 index 0000000..3685610 --- /dev/null +++ b/encryption/templates/wpa-psk @@ -0,0 +1,15 @@ +name = WPA 1/2 (Preshared Key) +author = Adam Blackburn +version = 1 +require apsk *Preshared_Key +----- +ctrl_interface=/var/run/wpa_supplicant +network={ + ssid="$_ESSID" + scan_ssid=$_SCAN + proto=WPA RSN + key_mgmt=WPA-PSK + pairwise=CCMP TKIP + group=CCMP TKIP + psk="$_APSK" +} From 92300133b83211a34ebefde2ba1098ced9b8b4a4 Mon Sep 17 00:00:00 2001 From: Dan O'Reilly Date: Tue, 23 Dec 2008 18:23:38 -0500 Subject: [PATCH 3/6] Fix "_" getting stripped from interface names. --- wicd/wnettools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wicd/wnettools.py b/wicd/wnettools.py index 0a0b9c2..5c70c75 100644 --- a/wicd/wnettools.py +++ b/wicd/wnettools.py @@ -41,7 +41,7 @@ import misc RALINK_DRIVER = 'ralink legacy' -blacklist_strict = punctuation.replace("-", "") + " " +blacklist_strict = '!"#$%&\'()*+,./:;<=>?@[\\]^`{|}~ ' blacklist_norm = ";`$!*|><&\\" blank_trans = maketrans("", "") From 10df01a9c2a63f161b6c5043b206ed3c05572b5f Mon Sep 17 00:00:00 2001 From: Dan O'Reilly Date: Tue, 23 Dec 2008 21:10:17 -0500 Subject: [PATCH 4/6] Tweak misc.to_unicode() so that it is more likely to encode to utf-8 correctly. --- wicd/misc.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/wicd/misc.py b/wicd/misc.py index d7e65e7..f3e2abe 100644 --- a/wicd/misc.py +++ b/wicd/misc.py @@ -302,13 +302,22 @@ def get_gettext(): def to_unicode(x): """ Attempts to convert a string to utf-8. """ # If this is a unicode string, encode it and return - if type(x) == unicode: + if type(x) not in [unicode, str]: + return x + if isinstance(x, unicode): return x.encode('utf-8') encoding = locale.getpreferredencoding() try: - ret = x.decode(encoding, 'replace').encode('utf-8') - except: - ret = x.decode('utf-8', 'replace').encode('utf-8') + ret = x.decode(encoding).encode('utf-8') + except UnicodeError: + try: + ret = x.decode('utf-8').encode('utf-8') + except UnicodeError: + try: + ret = x.decode('latin-1').encode('utf-8') + except UnicodeError: + ret = x.decode('utf-8', 'replace').encode('utf-8') + return ret def RenameProcess(new_name): @@ -509,8 +518,8 @@ def get_language_list_gui(): language['bad_pass'] = _('Connection Failed: Could not authenticate (bad password?)') language['done'] = _('Done connecting...') language['scanning'] = _('Scanning') - language['cannot_start_daemon'] = _("Unable to connect to wicd daemon DBus interface." + \ - "This typically means there was a problem starting the daemon." + \ + language['cannot_start_daemon'] = _("Unable to connect to wicd daemon DBus interface. " + \ + "This typically means there was a problem starting the daemon. " + \ "Check the wicd log for more info") language['lost_dbus'] = _("The wicd daemon has shut down, the UI will not function properly until it is restarted.") From b3d7f072d20131e220434e89b3ede6f9588bc886 Mon Sep 17 00:00:00 2001 From: Adam Blackburn Date: Tue, 23 Dec 2008 23:34:22 -0600 Subject: [PATCH 5/6] Added unit test for misc.py --- tests/__init__.py | 5 +- tests/testmisc.py | 145 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 149 insertions(+), 1 deletion(-) create mode 100644 tests/testmisc.py diff --git a/tests/__init__.py b/tests/__init__.py index 369c462..b26eaeb 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -6,4 +6,7 @@ def run_tests(): import testwnettools test_suite.addTest(testwnettools.suite()) - unittest.TextTestRunner(verbosity=5).run(test_suite) + import testmisc + test_suite.addTest(testmisc.suite()) + + unittest.TextTestRunner(verbosity=2).run(test_suite) diff --git a/tests/testmisc.py b/tests/testmisc.py new file mode 100644 index 0000000..c58b952 --- /dev/null +++ b/tests/testmisc.py @@ -0,0 +1,145 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +import unittest +from wicd import misc + +class TestMisc(unittest.TestCase): + def test_misc_run(self): + output = misc.Run(['echo', 'hi']).strip() + self.assertEquals('hi', output) + + def test_valid_ip_1(self): + self.assertTrue(misc.IsValidIP('0.0.0.0')) + + def test_valid_ip_2(self): + self.assertTrue(misc.IsValidIP('255.255.255.255')) + + def test_valid_ip_3(self): + self.assertTrue(misc.IsValidIP('10.0.1.1')) + + def test_invalid_ip_1(self): + self.assertFalse(misc.IsValidIP('-10.0.-1.-1')) + + def test_invalid_ip_2(self): + self.assertFalse(misc.IsValidIP('256.0.0.1')) + + def test_invalid_ip_3(self): + self.assertFalse(misc.IsValidIP('1000.0.0.1')) + + def test_run_valid_regex(self): + import re + regex = re.compile('.*(ABC.EFG).*') + found = misc.RunRegex(regex, '01234ABCDEFG56789') + self.assertEquals(found, 'ABCDEFG') + + def test_run_invalid_regex(self): + import re + regex = re.compile('.*(ABC.EFG).*') + found = misc.RunRegex(regex, '01234ABCEDFG56789') + self.assertEquals(found, None) + + def test_to_boolean_false(self): + self.assertFalse(misc.to_bool('False')) + + def test_to_boolean_0(self): + self.assertFalse(misc.to_bool('0')) + + def test_to_boolean_true(self): + self.assertTrue(misc.to_bool('True')) + + def test_to_boolean_true(self): + self.assertTrue(misc.to_bool('1')) + + def test_noneify_1(self): + self.assertEquals(misc.Noneify('None'), None) + + def test_noneify_2(self): + self.assertEquals(misc.Noneify(''), None) + + def test_noneify_3(self): + self.assertEquals(misc.Noneify(None), None) + + def test_noneify_4(self): + self.assertFalse(misc.Noneify('False')) + + def test_noneify_5(self): + self.assertFalse(misc.Noneify('0')) + + def test_noneify_6(self): + self.assertFalse(misc.Noneify(False)) + + def test_noneify_7(self): + self.assertTrue(misc.Noneify('True')) + + def test_noneify_8(self): + self.assertTrue(misc.Noneify('1')) + + def test_noneify_9(self): + self.assertTrue(misc.Noneify(True)) + + def test_noneify_10(self): + self.assertEquals(misc.Noneify('randomtext'), 'randomtext') + + def test_noneify_11(self): + self.assertEquals(misc.Noneify(5), 5) + + def test_none_to_string_1(self): + self.assertEquals(misc.noneToString(None), 'None') + + def test_none_to_string_2(self): + self.assertEquals(misc.noneToString(''), 'None') + + def test_none_to_string_3(self): + self.assertEquals(misc.noneToString(None), 'None') + + #################################################################### + # misc.to_unicode actually converts to utf-8, which is type str # + #################################################################### + + def test_to_unicode_1(self): + self.assertEquals(misc.to_unicode('邪悪'), '邪悪') + + def test_to_unicode_2(self): + self.assertEquals(misc.to_unicode(u'邪悪'), '邪悪') + + def test_to_unicode_3(self): + self.assertEquals(misc.to_unicode(u'abcdef'), 'abcdef') + + def test_to_unicode_4(self): + self.assertEquals(type(misc.to_unicode('abcdef'.encode('latin-1'))), str) + + def test_to_unicode_5(self): + self.assertEquals(misc.to_unicode("berkåk"), "berkåk") + + def test_to_unicode_6(self): + self.assertEquals(misc.to_unicode('berk\xe5k'), "berkåk") + + def test_none_to_blank_string_1(self): + self.assertEquals(misc.noneToBlankString(None), '') + + def test_none_to_blank_string_2(self): + self.assertEquals(misc.noneToBlankString('None'), '') + + def test_string_to_none_1(self): + self.assertEquals(misc.stringToNone(''), None) + + def test_string_to_none_2(self): + self.assertEquals(misc.stringToNone('None'), None) + + def test_string_to_none_3(self): + self.assertEquals(misc.stringToNone(None), None) + + def test_string_to_none_4(self): + self.assertEquals(misc.stringToNone('abcdef'), 'abcdef') + +def suite(): + suite = unittest.TestSuite() + tests = [] + [ tests.append(test) for test in dir(TestMisc) if test.startswith('test') ] + for test in tests: + suite.addTest(TestMisc(test)) + return suite + +if __name__ == '__main__': + unittest.main() From eb2959cdde7d5f6abaf5f17974ec3930cb513a52 Mon Sep 17 00:00:00 2001 From: Adam Blackburn Date: Wed, 24 Dec 2008 00:24:26 -0600 Subject: [PATCH 6/6] Removed stringToBoolean --- tests/__init__.py | 1 - wicd/misc.py | 8 -------- wicd/netentry.py | 8 ++++---- 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/tests/__init__.py b/tests/__init__.py index b26eaeb..20af68e 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,4 +1,3 @@ - def run_tests(): import unittest test_suite = unittest.TestSuite() diff --git a/wicd/misc.py b/wicd/misc.py index f3e2abe..476df90 100644 --- a/wicd/misc.py +++ b/wicd/misc.py @@ -564,14 +564,6 @@ def stringToNone(text): else: return str(text) -def stringToBoolean(text): - """ Turns a string representation of a bool to a boolean if needed. """ - if text in ("True", "1"): - return True - if text in ("False", "0"): - return False - return bool(text) - def checkboxTextboxToggle(checkbox, textboxes): for textbox in textboxes: textbox.set_sensitive(checkbox.get_active()) diff --git a/wicd/netentry.py b/wicd/netentry.py index 2e94691..b9581d1 100644 --- a/wicd/netentry.py +++ b/wicd/netentry.py @@ -19,7 +19,7 @@ import gtk import os import misc -from misc import noneToString, stringToNone, noneToBlankString, stringToBoolean +from misc import noneToString, stringToNone, noneToBlankString, to_bool import wpath language = misc.get_language_list_gui() @@ -526,7 +526,7 @@ class WiredNetworkEntry(NetworkEntry): self.script_button.connect("button-press-event", self.edit_scripts) # Toggle the default profile checkbox to the correct state. - if stringToBoolean(wired.GetWiredProperty("default")): + if to_bool(wired.GetWiredProperty("default")): self.chkbox_default_profile.set_active(True) else: self.chkbox_default_profile.set_active(False) @@ -666,7 +666,7 @@ class WiredNetworkEntry(NetworkEntry): self.advanced_dialog.prof_name = profile_name is_default = wired.GetWiredProperty("default") - self.chkbox_default_profile.set_active(stringToBoolean(is_default)) + self.chkbox_default_profile.set_active(to_bool(is_default)) def format_entry(self, label): """ Help method for fetching/formatting wired properties. """ @@ -728,7 +728,7 @@ class WirelessNetworkEntry(NetworkEntry): self.vbox_top.pack_start(self.chkbox_autoconnect, False, False) self.vbox_top.pack_start(self.hbox_status, True, True) - if stringToBoolean(self.format_entry(networkID, "automatic")): + if to_bool(self.format_entry(networkID, "automatic")): self.chkbox_autoconnect.set_active(True) else: self.chkbox_autoconnect.set_active(False)