Gestion des parametres wifi :
-Ajout de la gestion du hotspot -Correction d'un bug avec les positions vide -On vrifie l'integralit des variables nvram avant de les enregistrer darcs-hash:20061124143829-c3cc4-f25dfa7455f3f79b1cc634740ab666f2f9731678.gz
This commit is contained in:
parent
8ccabbd669
commit
4df72aab9f
1 changed files with 36 additions and 14 deletions
|
@ -1147,6 +1147,7 @@ def set_wifi(machine):
|
|||
* Puissance
|
||||
* Position GPS
|
||||
* Variables nvram
|
||||
* hotspot
|
||||
"""
|
||||
if not isadm:
|
||||
#ça ne devrait jamais arriver mais on n'est jamais trop prudent
|
||||
|
@ -1164,9 +1165,15 @@ def set_wifi(machine):
|
|||
# Borne wifi
|
||||
arg += u'"Canaux :" 1 1 "%s" 1 14 10 0 ' % machine.canal(None, False)
|
||||
arg += u'"Puissance :" 2 1 "%s" 2 14 4 0 ' % machine.puissance()
|
||||
try:
|
||||
arg += u'"Position N :" 3 1 "%s" 3 14 12 0 ' % machine.position()[0]
|
||||
arg += u'"Position E :" 3 29 "%s" 3 42 12 0 ' % machine.position()[1]
|
||||
arg += u'"Nvram (la valeur none supprime la variable) :" 4 1 "%s" 5 1 50 0 ' % ', '.join(machine.nvram())
|
||||
except:
|
||||
arg += u'"Position N :" 3 1 "%s" 3 14 12 0 ' % ""
|
||||
arg += u'"Position E :" 3 29 "%s" 3 42 12 0 ' % ""
|
||||
|
||||
arg += u'"Hotspot :" 4 1 "%s" 4 10 5 0 ' % (machine.hotspot() and 'oui' or 'non')
|
||||
arg += u'"Nvram (cf wiki) :" 5 1 "%s" 6 1 50 0 ' % ', '.join(machine.nvram())
|
||||
|
||||
# Affichage
|
||||
annul, result = dialog(arg)
|
||||
|
@ -1176,16 +1183,31 @@ def set_wifi(machine):
|
|||
err = ''
|
||||
try: machine.canal(result[0])
|
||||
except ValueError, c: err += c.args[0] + '\n'
|
||||
|
||||
try: machine.puissance(result[1])
|
||||
except ValueError, c: err += c.args[0] + '\n'
|
||||
try: machine.position((result[2].strip(),result[3].strip()))
|
||||
except ValueError, c: err += c.args[0] + '\n'
|
||||
|
||||
try:
|
||||
for nvram in result[4].split(','):
|
||||
#On n'enregistre pas une position vide
|
||||
if result[2].strip() and result[3].strip():
|
||||
machine.position((result[2].strip(),result[3].strip()))
|
||||
except ValueError, c: err += c.args[0] + '\n'
|
||||
|
||||
if result[4].lower().strip() == "oui":
|
||||
machine.hotspot(True)
|
||||
elif result[4].lower().strip() == "non":
|
||||
machine.hotspot(False)
|
||||
else:
|
||||
err += "Les valeurs possibles pour le parametre hotspot\n sont \"oui\" ou \"non\"\n"
|
||||
|
||||
try:
|
||||
#On vérifie toutes les variables avant de sauvegarder
|
||||
for nvram in result[5].split(','):
|
||||
if len(nvram.strip()): #On évite les variables vides
|
||||
if not '=' in nvram:
|
||||
err += "Une variable nvram doit etre de la forme : 'variable=valeur'\n"
|
||||
else :
|
||||
raise ValueError("Une variable nvram doit etre de la forme : 'variable=valeur'\n")
|
||||
for nvram in result[5].split(','):
|
||||
if len(nvram.strip()): #On évite les variables vides
|
||||
variable = nvram.split('=')[0].strip()
|
||||
valeur = nvram.split('=')[1].strip()
|
||||
if valeur.lower() == "none":
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue