1
0
mirror of https://github.com/gryf/wicd.git synced 2026-02-26 12:15:54 +01:00

Removed stringToBoolean

This commit is contained in:
Adam Blackburn
2008-12-24 00:24:26 -06:00
parent b3d7f072d2
commit eb2959cdde
3 changed files with 4 additions and 13 deletions

View File

@@ -1,4 +1,3 @@
def run_tests(): def run_tests():
import unittest import unittest
test_suite = unittest.TestSuite() test_suite = unittest.TestSuite()

View File

@@ -564,14 +564,6 @@ def stringToNone(text):
else: else:
return str(text) 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): def checkboxTextboxToggle(checkbox, textboxes):
for textbox in textboxes: for textbox in textboxes:
textbox.set_sensitive(checkbox.get_active()) textbox.set_sensitive(checkbox.get_active())

View File

@@ -19,7 +19,7 @@ import gtk
import os import os
import misc import misc
from misc import noneToString, stringToNone, noneToBlankString, stringToBoolean from misc import noneToString, stringToNone, noneToBlankString, to_bool
import wpath import wpath
language = misc.get_language_list_gui() language = misc.get_language_list_gui()
@@ -526,7 +526,7 @@ class WiredNetworkEntry(NetworkEntry):
self.script_button.connect("button-press-event", self.edit_scripts) self.script_button.connect("button-press-event", self.edit_scripts)
# Toggle the default profile checkbox to the correct state. # 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) self.chkbox_default_profile.set_active(True)
else: else:
self.chkbox_default_profile.set_active(False) self.chkbox_default_profile.set_active(False)
@@ -666,7 +666,7 @@ class WiredNetworkEntry(NetworkEntry):
self.advanced_dialog.prof_name = profile_name self.advanced_dialog.prof_name = profile_name
is_default = wired.GetWiredProperty("default") 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): def format_entry(self, label):
""" Help method for fetching/formatting wired properties. """ """ 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.chkbox_autoconnect, False, False)
self.vbox_top.pack_start(self.hbox_status, True, True) 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) self.chkbox_autoconnect.set_active(True)
else: else:
self.chkbox_autoconnect.set_active(False) self.chkbox_autoconnect.set_active(False)