mirror of
https://github.com/gryf/wicd.git
synced 2025-12-20 04:48:00 +01:00
Fixed wicd-curses to support the new template backend.
Made the cacert and clcert fields optional in the eap-tls template.
This commit is contained in:
@@ -192,11 +192,12 @@ class AdvancedSettingsDialog(urwid.WidgetWrap):
|
|||||||
self.overlay.mouse_event( dim,
|
self.overlay.mouse_event( dim,
|
||||||
event, button, col, row,
|
event, button, col, row,
|
||||||
focus=True)
|
focus=True)
|
||||||
k = self.overlay.keypress(dim, k)
|
else:
|
||||||
if k in ('up','page up'):
|
k = self.overlay.keypress(dim, k)
|
||||||
self._w.set_focus('body')
|
if k in ('up','page up'):
|
||||||
elif k in ('down','page down'):
|
self._w.set_focus('body')
|
||||||
self._w.set_focus('footer')
|
elif k in ('down','page down'):
|
||||||
|
self._w.set_focus('footer')
|
||||||
|
|
||||||
if "window resize" in keys:
|
if "window resize" in keys:
|
||||||
dim = ui.get_cols_rows()
|
dim = ui.get_cols_rows()
|
||||||
@@ -267,7 +268,7 @@ class WirelessSettingsDialog(AdvancedSettingsDialog):
|
|||||||
def __init__(self,networkID):
|
def __init__(self,networkID):
|
||||||
global wireless, daemon
|
global wireless, daemon
|
||||||
AdvancedSettingsDialog.__init__(self)
|
AdvancedSettingsDialog.__init__(self)
|
||||||
self.networkID = networkID
|
self.networkid = networkID
|
||||||
global_settings_t = language['global_settings']
|
global_settings_t = language['global_settings']
|
||||||
encryption_t = language['use_encryption']
|
encryption_t = language['use_encryption']
|
||||||
autoconnect_t = language['automatic_connect']
|
autoconnect_t = language['automatic_connect']
|
||||||
@@ -298,7 +299,7 @@ class WirelessSettingsDialog(AdvancedSettingsDialog):
|
|||||||
|
|
||||||
def set_values(self):
|
def set_values(self):
|
||||||
""" Set the various network settings to the right values. """
|
""" Set the various network settings to the right values. """
|
||||||
networkID = self.networkID
|
networkID = self.networkid
|
||||||
self.ip_edit.set_edit_text(self.format_entry(networkID,"ip"))
|
self.ip_edit.set_edit_text(self.format_entry(networkID,"ip"))
|
||||||
self.netmask_edit.set_edit_text(self.format_entry(networkID,"netmask"))
|
self.netmask_edit.set_edit_text(self.format_entry(networkID,"netmask"))
|
||||||
self.gateway_edit.set_edit_text(self.format_entry(networkID,"gateway"))
|
self.gateway_edit.set_edit_text(self.format_entry(networkID,"gateway"))
|
||||||
@@ -324,16 +325,12 @@ class WirelessSettingsDialog(AdvancedSettingsDialog):
|
|||||||
|
|
||||||
# Throw the encryption stuff into a list
|
# Throw the encryption stuff into a list
|
||||||
list = []
|
list = []
|
||||||
for x, enc_type in enumerate(self.encrypt_types):
|
|
||||||
list.append(enc_type[0])
|
|
||||||
self.encryption_combo.set_list(list)
|
|
||||||
|
|
||||||
self.change_encrypt_method()
|
|
||||||
activeID = -1 # Set the menu to this item when we are done
|
activeID = -1 # Set the menu to this item when we are done
|
||||||
user_enctype = wireless.GetWirelessProperty(networkID, "enctype")
|
|
||||||
for x, enc_type in enumerate(self.encrypt_types):
|
for x, enc_type in enumerate(self.encrypt_types):
|
||||||
if enc_type[1] == user_enctype:
|
list.append(enc_type['name'])
|
||||||
|
if enc_type['type'] == wireless.GetWirelessProperty(networkID, "enctype"):
|
||||||
activeID = x
|
activeID = x
|
||||||
|
self.encryption_combo.set_list(list)
|
||||||
|
|
||||||
self.encryption_combo.set_focus(activeID)
|
self.encryption_combo.set_focus(activeID)
|
||||||
if activeID != -1:
|
if activeID != -1:
|
||||||
@@ -343,9 +340,12 @@ class WirelessSettingsDialog(AdvancedSettingsDialog):
|
|||||||
else:
|
else:
|
||||||
self.encryption_combo.set_focus(0)
|
self.encryption_combo.set_focus(0)
|
||||||
|
|
||||||
|
self.change_encrypt_method()
|
||||||
|
|
||||||
|
|
||||||
def set_net_prop(self, option, value):
|
def set_net_prop(self, option, value):
|
||||||
""" Sets the given option to the given value for this network. """
|
""" Sets the given option to the given value for this network. """
|
||||||
wireless.SetWirelessProperty(self.networkID, option, value)
|
wireless.SetWirelessProperty(self.networkid, option, value)
|
||||||
|
|
||||||
def format_entry(self, networkid, label):
|
def format_entry(self, networkid, label):
|
||||||
""" Helper method for fetching/formatting wireless properties. """
|
""" Helper method for fetching/formatting wireless properties. """
|
||||||
@@ -356,25 +356,32 @@ class WirelessSettingsDialog(AdvancedSettingsDialog):
|
|||||||
# Check encryption info
|
# Check encryption info
|
||||||
if self.encryption_chkbox.get_state():
|
if self.encryption_chkbox.get_state():
|
||||||
#print "setting encryption info..."
|
#print "setting encryption info..."
|
||||||
encryption_info = self.encryption_info
|
encrypt_info = self.encryption_info
|
||||||
encrypt_methods = misc.LoadEncryptionMethods()
|
encrypt_methods = self.encrypt_types
|
||||||
self.set_net_prop("enctype",
|
self.set_net_prop("enctype",
|
||||||
encrypt_methods[self.encryption_combo.get_focus()[1] ][1])
|
encrypt_methods[self.encryption_combo.get_focus()[1] ]['type'])
|
||||||
for x in encryption_info:
|
# Make sure all required fields are filled in.
|
||||||
if encryption_info[x].get_edit_text() == "":
|
for entry_info in encrypt_info.itervalues():
|
||||||
error(self.ui, self.overlay,language['encrypt_info_missing'])
|
if entry_info[0].get_edit_text() == "" \
|
||||||
|
and entry_info[1] == 'required':
|
||||||
|
error(self.ui, self.overlay,"%s (%s)" \
|
||||||
|
% (language['encrypt_info_missing'],
|
||||||
|
entry_info[0].get_captionabel() )
|
||||||
|
)
|
||||||
return False
|
return False
|
||||||
self.set_net_prop(x, noneToString(encryption_info[x].
|
|
||||||
|
for entry_key, entry_info in encrypt_info.iteritems():
|
||||||
|
self.set_net_prop(entry_key, noneToString(entry_info[0].
|
||||||
get_edit_text()))
|
get_edit_text()))
|
||||||
elif not self.encryption_chkbox.get_state() and \
|
elif not self.encryption_chkbox.get_state() and \
|
||||||
wireless.GetWirelessProperty(self.networkID, "encryption"):
|
wireless.GetWirelessProperty(self.networkid, "encryption"):
|
||||||
|
# Encrypt checkbox is off, but the network needs it.
|
||||||
error(self.ui, self.overlay, language['enable_encryption'])
|
error(self.ui, self.overlay, language['enable_encryption'])
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
#print 'encryption is ' + str(wireless.GetWirelessProperty(self.networkID,
|
|
||||||
# "encryption"))
|
|
||||||
#print "no encryption specified..."
|
|
||||||
self.set_net_prop("enctype", "None")
|
self.set_net_prop("enctype", "None")
|
||||||
|
for entry in encrypt_info.iterkeys():
|
||||||
|
self.set_net_prop(entry[0].entry, "")
|
||||||
AdvancedSettingsDialog.save_settings(self)
|
AdvancedSettingsDialog.save_settings(self)
|
||||||
|
|
||||||
# Save the autoconnect setting. This is not where it originally was
|
# Save the autoconnect setting. This is not where it originally was
|
||||||
@@ -385,9 +392,9 @@ class WirelessSettingsDialog(AdvancedSettingsDialog):
|
|||||||
self.set_net_prop('use_settings_globally', True)
|
self.set_net_prop('use_settings_globally', True)
|
||||||
else:
|
else:
|
||||||
self.set_net_prop('use_settings_globally', False)
|
self.set_net_prop('use_settings_globally', False)
|
||||||
wireless.RemoveGlobalEssidEntry(self.networkID)
|
wireless.RemoveGlobalEssidEntry(self.networkid)
|
||||||
|
|
||||||
wireless.SaveWirelessNetworkProfile(self.networkID)
|
wireless.SaveWirelessNetworkProfile(self.networkid)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# More or less ripped from netentry.py
|
# More or less ripped from netentry.py
|
||||||
@@ -402,26 +409,29 @@ class WirelessSettingsDialog(AdvancedSettingsDialog):
|
|||||||
|
|
||||||
# If nothing is selected, select the first entry.
|
# If nothing is selected, select the first entry.
|
||||||
if ID == -1:
|
if ID == -1:
|
||||||
self.encryption_combo.set_active(0)
|
self.encryption_combo.set_focus(0)
|
||||||
ID = 0
|
ID = 0
|
||||||
|
|
||||||
opts = methods[ID][2]
|
|
||||||
theList = []
|
theList = []
|
||||||
for x in opts:
|
for type_ in ['required', 'optional']:
|
||||||
edit = None
|
fields = methods[ID][type_]
|
||||||
if language.has_key(opts[x][0]):
|
for field in fields:
|
||||||
edit = MaskingEdit(('editcp',language[opts[x][0].lower().replace(' ','_')]+': '),mask_mode='no_focus')
|
if language.has_key(field[1]):
|
||||||
else:
|
edit = MaskingEdit(('editcp',language[field[1].lower().replace(' ','_')]+': '))
|
||||||
edit = MaskingEdit(('editcp',opts[x][0].replace('_',' ')+': '),mask_mode='no_focus')
|
else:
|
||||||
theList.append(edit)
|
edit = MaskingEdit(('editcp',field[1].replace('_',' ')+': '))
|
||||||
# Add the data to any array, so that the information
|
edit.set_mask_mode('no_focus')
|
||||||
# can be easily accessed by giving the name of the wanted
|
theList.append(edit)
|
||||||
# data.
|
# Add the data to any array, so that the information
|
||||||
self.encryption_info[opts[x][1]] = edit
|
# can be easily accessed by giving the name of the wanted
|
||||||
|
# data.
|
||||||
|
self.encryption_info[field[0]] = [edit, type_]
|
||||||
|
|
||||||
edit.set_edit_text(noneToBlankString(
|
edit.set_edit_text(noneToBlankString(
|
||||||
wireless.GetWirelessProperty(self.networkID, opts[x][1])))
|
wireless.GetWirelessProperty(self.networkid, field[0])))
|
||||||
|
|
||||||
|
#FIXME: This causes the entire pile to light up upon use.
|
||||||
|
# Make this into a listbox?
|
||||||
self.pile_encrypt = DynWrap(urwid.Pile(theList),attrs=('editbx','editnfc'))
|
self.pile_encrypt = DynWrap(urwid.Pile(theList),attrs=('editbx','editnfc'))
|
||||||
self._w.body.body.insert(self._w.body.body.__len__(),self.pile_encrypt)
|
self._w.body.body.insert(self._w.body.body.__len__(),self.pile_encrypt)
|
||||||
#self._w.body.body.append(self.pile_encrypt)
|
#self._w.body.body.append(self.pile_encrypt)
|
||||||
|
|||||||
@@ -796,13 +796,18 @@ class appGUI():
|
|||||||
about_dialog(self.frame)
|
about_dialog(self.frame)
|
||||||
if "C" in keys:
|
if "C" in keys:
|
||||||
focus = self.thePile.get_focus()
|
focus = self.thePile.get_focus()
|
||||||
if focus == self.wiredCB:
|
try:
|
||||||
WiredSettingsDialog(self.wiredCB.get_body().
|
if focus == self.wiredCB:
|
||||||
get_selected_profile()).run(ui,self.size,self.frame)
|
WiredSettingsDialog(self.wiredCB.get_body().
|
||||||
else:
|
get_selected_profile()).run(ui,self.size,self.frame)
|
||||||
# wireless list only other option
|
else:
|
||||||
wid,pos = self.thePile.get_focus().get_focus()
|
# wireless list only other option
|
||||||
WirelessSettingsDialog(pos).run(ui,self.size,self.frame)
|
wid,pos = self.thePile.get_focus().get_focus()
|
||||||
|
WirelessSettingsDialog(pos).run(ui,self.size,self.frame)
|
||||||
|
except:
|
||||||
|
# wtf do I need this?
|
||||||
|
loop.quit()
|
||||||
|
raise
|
||||||
#self.netentry = NetEntryBase(dbusmanager.get_dbus_ifaces())
|
#self.netentry = NetEntryBase(dbusmanager.get_dbus_ifaces())
|
||||||
#self.netentry.run(ui,self.size,self.frame)
|
#self.netentry.run(ui,self.size,self.frame)
|
||||||
if "I" in keys:
|
if "I" in keys:
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
name = EAP-TLS
|
name = EAP-TLS
|
||||||
author = Dan O'Reilly
|
author = Dan O'Reilly
|
||||||
version = 1
|
version = 1
|
||||||
require identity *Identity ca_cert *Path_to_CA_Cert client_cert *Path_to_Client_Cert private_key *Private_Key private_key_passwd *Private_Key_Password
|
require identity *Identity private_key *Private_Key private_key_passwd *Private_Key_Password
|
||||||
|
optional ca_cert *Path_to_CA_Cert client_cert *Path_to_Client_Cert
|
||||||
|
|
||||||
-----
|
-----
|
||||||
ctrl_interface=/var/run/wpa_supplicant
|
ctrl_interface=/var/run/wpa_supplicant
|
||||||
network={
|
network={
|
||||||
|
|||||||
Reference in New Issue
Block a user