mirror of
https://github.com/gryf/wicd.git
synced 2025-12-19 12:28:08 +01:00
Merged in Dan's enctemplates branch, and repaired two code merge conflicts.
This commit is contained in:
@@ -211,7 +211,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']
|
||||||
@@ -242,7 +242,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"))
|
||||||
@@ -268,17 +268,13 @@ class WirelessSettingsDialog(AdvancedSettingsDialog):
|
|||||||
|
|
||||||
# Throw the encryption stuff into a list
|
# Throw the encryption stuff into a list
|
||||||
list = []
|
list = []
|
||||||
|
activeID = -1 # Set the menu to this item when we are done
|
||||||
for x, enc_type in enumerate(self.encrypt_types):
|
for x, enc_type in enumerate(self.encrypt_types):
|
||||||
list.append(enc_type[0])
|
list.append(enc_type['name'])
|
||||||
|
if enc_type['type'] == wireless.GetWirelessProperty(networkID, "enctype"):
|
||||||
|
activeID = x
|
||||||
self.encryption_combo.set_list(list)
|
self.encryption_combo.set_list(list)
|
||||||
|
|
||||||
self.change_encrypt_method()
|
|
||||||
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):
|
|
||||||
if enc_type[1] == user_enctype:
|
|
||||||
activeID = x
|
|
||||||
|
|
||||||
self.encryption_combo.set_focus(activeID)
|
self.encryption_combo.set_focus(activeID)
|
||||||
if activeID != -1:
|
if activeID != -1:
|
||||||
self.encryption_chkbox.set_state(True,do_callback=False)
|
self.encryption_chkbox.set_state(True,do_callback=False)
|
||||||
@@ -287,9 +283,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. """
|
||||||
@@ -300,25 +299,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.body,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"):
|
||||||
error(self.ui, self.body, language['enable_encryption'])
|
# Encrypt checkbox is off, but the network needs it.
|
||||||
|
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
|
||||||
@@ -329,9 +335,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
|
||||||
@@ -346,26 +352,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)
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
name = EAP-FAST
|
name = EAP-FAST
|
||||||
author = Adam Blackburn
|
author = Adam Blackburn
|
||||||
version = 2
|
version = 2
|
||||||
require username *Username password *Password pac_file *Path_To_PAC_File
|
require username *Username password *Password
|
||||||
|
optional pac_file *Path_To_PAC_File
|
||||||
-----
|
-----
|
||||||
ctrl_interface=/var/run/wpa_supplicant
|
ctrl_interface=/var/run/wpa_supplicant
|
||||||
network={
|
network={
|
||||||
|
|||||||
@@ -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={
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
name = PEAP with TKIP
|
name = PEAP with TKIP/MSCHAPV2
|
||||||
author = Fralaltro
|
author = Fralaltro
|
||||||
version = 1
|
version = 1
|
||||||
require identity *Identity password *Password ca_cert *Path_to_CA_Cert
|
require identity *Identity password *Password
|
||||||
|
optional ca_cert *Path_to_CA_Cert
|
||||||
-----
|
-----
|
||||||
ctrl_interface=/var/run/wpa_supplicant
|
ctrl_interface=/var/run/wpa_supplicant
|
||||||
network={
|
network={
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
name = WEP (Hex)
|
name = WEP (Hex [0-9/A-F])
|
||||||
author = Adam Blackburn
|
author = Adam Blackburn
|
||||||
version = 1
|
version = 1
|
||||||
require key *Key
|
require key *Key
|
||||||
|
|||||||
@@ -632,9 +632,12 @@ class appGui(object):
|
|||||||
# Make sure no entries are left blank
|
# Make sure no entries are left blank
|
||||||
if entry.chkbox_encryption.get_active():
|
if entry.chkbox_encryption.get_active():
|
||||||
encryption_info = entry.encryption_info
|
encryption_info = entry.encryption_info
|
||||||
for x in encryption_info:
|
for entry_info in encryption_info.itervalues():
|
||||||
if encryption_info[x].get_text() == "":
|
if entry_info[0].entry.get_text() == "" and \
|
||||||
error(self.window, language['encrypt_info_missing'])
|
entry_info[1] == 'required':
|
||||||
|
error(self, "%s (%s)" % (language['encrypt_info_missing'],
|
||||||
|
entry_info[0].label.get_label())
|
||||||
|
)
|
||||||
return False
|
return False
|
||||||
# Make sure the checkbox is checked when it should be
|
# Make sure the checkbox is checked when it should be
|
||||||
elif not entry.chkbox_encryption.get_active() and \
|
elif not entry.chkbox_encryption.get_active() and \
|
||||||
|
|||||||
110
wicd/misc.py
110
wicd/misc.py
@@ -276,10 +276,6 @@ def LoadEncryptionMethods():
|
|||||||
loaded, the template must be listed in the "active" file.
|
loaded, the template must be listed in the "active" file.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
def parse_ent(line, key):
|
|
||||||
return line.replace(key, "").replace("=", "").strip()
|
|
||||||
|
|
||||||
encryptionTypes = []
|
|
||||||
try:
|
try:
|
||||||
enctypes = open(wpath.encryption + "active","r").readlines()
|
enctypes = open(wpath.encryption + "active","r").readlines()
|
||||||
except IOError, e:
|
except IOError, e:
|
||||||
@@ -287,49 +283,73 @@ def LoadEncryptionMethods():
|
|||||||
raise IOError(e)
|
raise IOError(e)
|
||||||
|
|
||||||
# Parse each encryption method
|
# Parse each encryption method
|
||||||
for x in enctypes:
|
encryptionTypes = []
|
||||||
x = x.strip()
|
for enctype in enctypes:
|
||||||
try:
|
parsed_template = _parse_enc_template(enctype.strip())
|
||||||
f = open(wpath.encryption + x, "r")
|
if parsed_template:
|
||||||
except IOError:
|
encryptionTypes.append(parsed_template)
|
||||||
print 'Failed to load encryption type ' + str(x)
|
|
||||||
continue
|
|
||||||
line = f.readlines()
|
|
||||||
f.close()
|
|
||||||
|
|
||||||
cur_type = {}
|
|
||||||
cur_type[0] = parse_ent(line[0], "name")
|
|
||||||
cur_type[1] = x
|
|
||||||
cur_type[2] = {}
|
|
||||||
|
|
||||||
# Find the line containing our required fields.
|
|
||||||
i = 1
|
|
||||||
try:
|
|
||||||
while not line[i].startswith("require"):
|
|
||||||
i += 1
|
|
||||||
except IndexError:
|
|
||||||
print "Bad encryption template: Couldn't find 'require' line"
|
|
||||||
requiredFields = parse_ent(line[i], "require")
|
|
||||||
requiredFields = requiredFields.split(" ")
|
|
||||||
|
|
||||||
# Get the required fields.
|
|
||||||
index = -1
|
|
||||||
for current in requiredFields:
|
|
||||||
# The pretty names will start with an * so we can
|
|
||||||
# separate them with that.
|
|
||||||
if current[0] == "*":
|
|
||||||
# Make underscores spaces
|
|
||||||
# and remove the *
|
|
||||||
cur_type[2][index][0] = current.replace("_", " ").lstrip("*")
|
|
||||||
else:
|
|
||||||
# Add to the list of things that are required.
|
|
||||||
index = len(cur_type[2])
|
|
||||||
cur_type[2][index] = {}
|
|
||||||
cur_type[2][index][1] = current
|
|
||||||
# Add the current type to the dict of encryption types.
|
|
||||||
encryptionTypes.append(cur_type)
|
|
||||||
return encryptionTypes
|
return encryptionTypes
|
||||||
|
|
||||||
|
def __parse_field_ent(fields, field_type='require'):
|
||||||
|
fields = fields.split(" ")
|
||||||
|
ret = []
|
||||||
|
# We need an even number of entries in the line for it to be valid.
|
||||||
|
if (len(fields) % 2) != 0:
|
||||||
|
print "Invalid '%s' line found in template %s" % (field_type, enctype)
|
||||||
|
return None
|
||||||
|
else:
|
||||||
|
for val, disp_val in grouper(2, fields, fillvalue=None):
|
||||||
|
if val.startswith("*") or not disp_val.startswith("*"):
|
||||||
|
print "Invalid '%s' line found in template %s" % (field_type, enctype)
|
||||||
|
return None
|
||||||
|
ret.append([val, disp_val[1:]])
|
||||||
|
return ret
|
||||||
|
|
||||||
|
def _parse_enc_template(enctype):
|
||||||
|
""" Parse an encryption template. """
|
||||||
|
def parse_ent(line, key):
|
||||||
|
return line.replace(key, "").replace("=", "").strip()
|
||||||
|
|
||||||
|
try:
|
||||||
|
f = open(os.path.join(wpath.encryption, enctype), "r")
|
||||||
|
except IOError:
|
||||||
|
print "Failed to open template file %s" % enctype
|
||||||
|
return None
|
||||||
|
|
||||||
|
cur_type = {}
|
||||||
|
cur_type["type"] = enctype
|
||||||
|
cur_type["fields"] = []
|
||||||
|
cur_type['optional'] = []
|
||||||
|
cur_type['required'] = []
|
||||||
|
for index, line in enumerate(f):
|
||||||
|
if line.startswith("name") and not "name" in cur_type:
|
||||||
|
cur_type["name"] = parse_ent(line, "name")
|
||||||
|
elif line.startswith("require"):
|
||||||
|
cur_type["required"] = __parse_field_ent(parse_ent(line,
|
||||||
|
"require"))
|
||||||
|
if not cur_type["required"]:
|
||||||
|
# An error occured parsing the require line.
|
||||||
|
continue
|
||||||
|
elif line.startswith("optional"):
|
||||||
|
cur_type["optional"] = __parse_field_ent(parse_ent(line,
|
||||||
|
"optional"),
|
||||||
|
field_type="optional")
|
||||||
|
if not cur_type["optional"]:
|
||||||
|
# An error occured parsing the optional line.
|
||||||
|
continue
|
||||||
|
elif line.startswith("----"):
|
||||||
|
# We're done.
|
||||||
|
break
|
||||||
|
f.close()
|
||||||
|
if not cur_type["required"]:
|
||||||
|
print "Failed to find a 'require' line in template %s" % enctype
|
||||||
|
return None
|
||||||
|
if not cur_type["name"]:
|
||||||
|
print "Failed to find a 'name' line in template %s" % enctype
|
||||||
|
return None
|
||||||
|
else:
|
||||||
|
return cur_type
|
||||||
|
|
||||||
def noneToString(text):
|
def noneToString(text):
|
||||||
""" Convert None, "None", or "" to string type "None"
|
""" Convert None, "None", or "" to string type "None"
|
||||||
|
|
||||||
|
|||||||
@@ -308,8 +308,8 @@ class WirelessSettingsDialog(AdvancedSettingsDialog):
|
|||||||
# Build the encryption menu
|
# Build the encryption menu
|
||||||
activeID = -1 # Set the menu to this item when we are done
|
activeID = -1 # Set the menu to this item when we are done
|
||||||
for x, enc_type in enumerate(self.encrypt_types):
|
for x, enc_type in enumerate(self.encrypt_types):
|
||||||
self.combo_encryption.append_text(enc_type[0])
|
self.combo_encryption.append_text(enc_type['name'])
|
||||||
if enc_type[1] == wireless.GetWirelessProperty(networkID, "enctype"):
|
if enc_type['type'] == wireless.GetWirelessProperty(networkID, "enctype"):
|
||||||
activeID = x
|
activeID = x
|
||||||
self.combo_encryption.set_active(activeID)
|
self.combo_encryption.set_active(activeID)
|
||||||
if activeID != -1:
|
if activeID != -1:
|
||||||
@@ -384,7 +384,7 @@ class WirelessSettingsDialog(AdvancedSettingsDialog):
|
|||||||
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")
|
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:
|
if enc_type['type'] == user_enctype:
|
||||||
activeID = x
|
activeID = x
|
||||||
|
|
||||||
self.combo_encryption.set_active(activeID)
|
self.combo_encryption.set_active(activeID)
|
||||||
@@ -400,24 +400,32 @@ class WirelessSettingsDialog(AdvancedSettingsDialog):
|
|||||||
# Check encryption info
|
# Check encryption info
|
||||||
if self.chkbox_encryption.get_active():
|
if self.chkbox_encryption.get_active():
|
||||||
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.combo_encryption.get_active()][1])
|
encrypt_methods[self.combo_encryption.get_active()]['type'])
|
||||||
for x in encryption_info:
|
# Make sure all required fields are filled in.
|
||||||
if encryption_info[x].get_text() == "":
|
for entry_info in encrypt_info.itervalues():
|
||||||
error(self, language['encrypt_info_missing'])
|
if entry_info[0].entry.get_text() == "" and \
|
||||||
|
entry_info[1] == 'required':
|
||||||
|
error(self, "%s (%s)" % (language['encrypt_info_missing'],
|
||||||
|
entry_info[0].label.get_label())
|
||||||
|
)
|
||||||
return False
|
return False
|
||||||
self.set_net_prop(x, noneToString(encryption_info[x].get_text()))
|
# Now save all the entries.
|
||||||
|
for entry_key, entry_info in encrypt_info.iteritems():
|
||||||
|
self.set_net_prop(entry_key,
|
||||||
|
noneToString(entry_info[0].entry.get_text()))
|
||||||
elif not self.chkbox_encryption.get_active() and \
|
elif not self.chkbox_encryption.get_active() and \
|
||||||
wireless.GetWirelessProperty(networkid, "encryption"):
|
wireless.GetWirelessProperty(networkid, "encryption"):
|
||||||
|
# Encrypt checkbox is off, but the network needs it.
|
||||||
error(self, language['enable_encryption'])
|
error(self, language['enable_encryption'])
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
print "no encryption specified..."
|
print "no encryption specified..."
|
||||||
self.set_net_prop("enctype", "None")
|
self.set_net_prop("enctype", "None")
|
||||||
for x in self.encryption_info:
|
for entry in encrypt_info.iterkeys():
|
||||||
self.set_net_prop(x, "")
|
self.set_net_prop(entry[0].entry, "")
|
||||||
AdvancedSettingsDialog.save_settings(self)
|
AdvancedSettingsDialog.save_settings(self)
|
||||||
|
|
||||||
if self.chkbox_global_settings.get_active():
|
if self.chkbox_global_settings.get_active():
|
||||||
@@ -444,7 +452,7 @@ class WirelessSettingsDialog(AdvancedSettingsDialog):
|
|||||||
for z in self.vbox_encrypt_info:
|
for z in self.vbox_encrypt_info:
|
||||||
z.destroy() # Remove stuff in there already
|
z.destroy() # Remove stuff in there already
|
||||||
ID = self.combo_encryption.get_active()
|
ID = self.combo_encryption.get_active()
|
||||||
methods = misc.LoadEncryptionMethods()
|
methods = self.encrypt_types
|
||||||
self.encryption_info = {}
|
self.encryption_info = {}
|
||||||
|
|
||||||
# If nothing is selected, select the first entry.
|
# If nothing is selected, select the first entry.
|
||||||
@@ -452,22 +460,22 @@ class WirelessSettingsDialog(AdvancedSettingsDialog):
|
|||||||
self.combo_encryption.set_active(0)
|
self.combo_encryption.set_active(0)
|
||||||
ID = 0
|
ID = 0
|
||||||
|
|
||||||
opts = methods[ID][2]
|
for type_ in ['required', 'optional']:
|
||||||
for x in opts:
|
fields = methods[ID][type_]
|
||||||
box = None
|
for field in fields:
|
||||||
if language.has_key(opts[x][0]):
|
if language.has_key(field[1]):
|
||||||
box = LabelEntry(language[opts[x][0].lower().replace(' ','_')])
|
box = LabelEntry(language[field[1].lower().replace(' ','_')])
|
||||||
else:
|
else:
|
||||||
box = LabelEntry(opts[x][0].replace('_',' '))
|
box = LabelEntry(field[1].replace('_',' '))
|
||||||
box.set_auto_hidden(True)
|
box.set_auto_hidden(True)
|
||||||
self.vbox_encrypt_info.pack_start(box)
|
self.vbox_encrypt_info.pack_start(box)
|
||||||
# Add the data to any array, so that the information
|
# Add the data to a dict, so that the information
|
||||||
# can be easily accessed by giving the name of the wanted
|
# can be easily accessed by giving the name of the wanted
|
||||||
# data.
|
# data.
|
||||||
self.encryption_info[opts[x][1]] = box.entry
|
self.encryption_info[field[0]] = [box, type_]
|
||||||
|
|
||||||
box.entry.set_text(noneToBlankString(
|
box.entry.set_text(noneToBlankString(
|
||||||
wireless.GetWirelessProperty(self.networkID, opts[x][1])))
|
wireless.GetWirelessProperty(self.networkID, field[0])))
|
||||||
self.vbox_encrypt_info.show_all()
|
self.vbox_encrypt_info.show_all()
|
||||||
|
|
||||||
|
|
||||||
@@ -740,7 +748,7 @@ class WirelessNetworkEntry(NetworkEntry):
|
|||||||
self.set_encryption(wireless.GetWirelessProperty(networkID,
|
self.set_encryption(wireless.GetWirelessProperty(networkID,
|
||||||
'encryption'),
|
'encryption'),
|
||||||
wireless.GetWirelessProperty(networkID,
|
wireless.GetWirelessProperty(networkID,
|
||||||
'encryption_method'))
|
'encryption_method'))
|
||||||
self.set_channel(wireless.GetWirelessProperty(networkID, 'channel'))
|
self.set_channel(wireless.GetWirelessProperty(networkID, 'channel'))
|
||||||
self.name_label.set_use_markup(True)
|
self.name_label.set_use_markup(True)
|
||||||
self.name_label.set_label("%s %s %s %s" % (self._escape(self.essid),
|
self.name_label.set_label("%s %s %s %s" % (self._escape(self.essid),
|
||||||
|
|||||||
Reference in New Issue
Block a user