1
0
mirror of https://github.com/gryf/wicd.git synced 2025-12-19 12:28:08 +01:00

Some more bugfixes...

Fixed unencrypted network support in both UIs.
Fixed marking the Static IP checkbox in wicd-curses.
Made the checkboxes in the the network properties dialogs in wicd-curses act
  like those in wicd-client.
Filter the urwid popen2 warning in wicd-curses.
This commit is contained in:
Andrew Psaltis
2009-05-01 22:13:15 -04:00
parent f8503bea9e
commit d54f7e0802
3 changed files with 21 additions and 13 deletions

View File

@@ -62,17 +62,17 @@ class AdvancedSettingsDialog(urwid.WidgetWrap):
ok_t = 'OK'
self.static_ip_cb = urwid.CheckBox(static_ip_t,
on_state_change=self.static_ip_set_state)
on_state_change=self.static_ip_toggle)
self.ip_edit =DynWrap(urwid.Edit(ip_t),False)
self.netmask_edit=DynWrap(urwid.Edit(netmask_t),False)
self.gateway_edit=DynWrap(urwid.Edit(gateway_t),False)
self.static_dns_cb = urwid.CheckBox(use_static_dns_t,
on_state_change=self.dns_toggle)
self.static_dns_cb = DynWrap(urwid.CheckBox(use_static_dns_t,
on_state_change=self.dns_toggle),True,('body','editnfc'),None)
self.global_dns_cb = DynWrap(urwid.CheckBox(use_global_dns_t,
on_state_change=self.dns_toggle),False,('body','editnfc'),None)
checkb_cols = urwid.Columns([self.static_dns_cb,
self.checkb_cols = urwid.Columns([self.static_dns_cb,
self.global_dns_cb])
self.dns_dom_edit = DynWrap(urwid.Edit(dns_dom_t) ,False)
self.search_dom_edit = DynWrap(urwid.Edit(search_dom_t),False)
@@ -87,7 +87,7 @@ class AdvancedSettingsDialog(urwid.WidgetWrap):
self.netmask_edit,
self.gateway_edit,
_blank,
checkb_cols,
self.checkb_cols,
self.dns_dom_edit,self.search_dom_edit,
self.dns1,self.dns2,self.dns3
])
@@ -99,12 +99,19 @@ class AdvancedSettingsDialog(urwid.WidgetWrap):
self._frame = urwid.Frame(self._listbox)
self.__super.__init__(self._frame)
def static_ip_set_state(self,checkb,new_state,user_data=None):
def static_ip_toggle(self,checkb,new_state,user_data=None):
for w in [ self.ip_edit,self.netmask_edit,self.gateway_edit ]:
w.set_sensitive(new_state)
self.static_dns_cb.set_state(new_state)
self.static_dns_cb.set_sensitive(not new_state)
if new_state:
self.checkb_cols.set_focus(self.global_dns_cb)
else:
self.checkb_cols.set_focus(self.static_dns_cb)
def dns_toggle(self,checkb,new_state,user_data=None):
if checkb == self.static_dns_cb:
if checkb == self.static_dns_cb.get_w():
for w in [ self.dns_dom_edit,self.search_dom_edit,
self.dns1,self.dns2,self.dns3 ]:
w.set_sensitive(new_state)
@@ -256,6 +263,8 @@ class WirelessSettingsDialog(AdvancedSettingsDialog):
self.static_dns_cb.set_state(bool(wireless.GetWirelessProperty(networkID,
'use_static_dns')))
if stringToNone(self.ip_edit.get_edit_text()):
self.static_ip_cb.set_state(True)
self.dns1.set_edit_text(self.format_entry(networkID, "dns1"))
self.dns2.set_edit_text(self.format_entry(networkID, "dns2"))
self.dns3.set_edit_text(self.format_entry(networkID, "dns3"))
@@ -327,8 +336,6 @@ class WirelessSettingsDialog(AdvancedSettingsDialog):
return False
else:
self.set_net_prop("enctype", "None")
for entry in encrypt_info.iterkeys():
self.set_net_prop(entry[0].entry, "")
AdvancedSettingsDialog.save_settings(self)
# Save the autoconnect setting. This is not where it originally was
@@ -347,9 +354,9 @@ class WirelessSettingsDialog(AdvancedSettingsDialog):
# More or less ripped from netentry.py
def change_encrypt_method(self):
#self.lbox_encrypt = urwid.ListBox()
self.encryption_info = {}
wid,ID = self.encryption_combo.get_focus()
methods = misc.LoadEncryptionMethods()
self.encryption_info = {}
if self._w.body.body.__contains__(self.pile_encrypt):
self._w.body.body.pop(self._w.body.body.__len__()-1)

View File

@@ -33,7 +33,10 @@ at least get a network connection. Or those who don't like using X. ;-)
Comments, criticisms, patches, bug reports all welcome!
"""
# Filter out a confusing urwid warning in python 2.6.
# This is valid as of urwid version 0.9.8.4
import warnings
warnings.filterwarnings("ignore","The popen2 module is deprecated. Use the subprocess module.")
# UI stuff
# This library is the only reason why I wrote this program.
import urwid

View File

@@ -431,8 +431,6 @@ class WirelessSettingsDialog(AdvancedSettingsDialog):
else:
print "no encryption specified..."
self.set_net_prop("enctype", "None")
for entry in encrypt_info.iterkeys():
self.set_net_prop(entry[0].entry, "")
AdvancedSettingsDialog.save_settings(self)
if self.chkbox_global_settings.get_active():