* Champ position des bornes

* whos -h plus concis

darcs-hash:20060313215451-68412-33985b31e41aabeba4f38fad4426029b2d4bf8f8.gz
This commit is contained in:
glondu 2006-03-13 22:54:51 +01:00
parent 6604677322
commit 3fe5d7be00
2 changed files with 80 additions and 33 deletions

View file

@ -498,10 +498,14 @@ def machine_details(machine) :
# Borne wifi
if isinstance(machine, BorneWifi):
f += coul(u'Hotspot : ', 'gras')
if machine.hotspot():
f += 'oui\n'
f += machine.hotspot() and 'oui' or 'non'
position = machine.position()
if position:
f += coul(u'\t\t\tCoordonnées : ', 'gras')
f += '(%.6g, %.6g)\n' % (position[0], position[1])
else:
f += 'non\n'
f += '\n'
f += coul(u'Puissance : ','gras') + u"%4.d" % int(machine.puissance())
f += coul(u'\tCanaux : ', 'gras') + machine.canal()
f += coul(u'\tÉtat : ', 'gras')
@ -821,32 +825,49 @@ def __usage_brief(err='') :
def __usage() :
""" Comment ca marche ? """
list = ['']
for c in base.auto_search_champs.values() :
for champ in c :
coul_champ = coul(champ,'bleu')
if list[-1] == '' :
list[-1] = coul_champ
l = len(champ)
else :
l += len(champ) + 2
if l < 80 :
list[-1] += ', ' + coul_champ
else :
list.append(coul_champ)
l = len(champ)
liste = []
accu = ""
longueur = 0
for c in base.non_auto_search_champs.values() :
for champ in c :
l += len(champ) + 2
if l < 80 :
list[-1] += ', ' + champ
else :
list.append(champ)
l = len(champ)
# Champs automatiques
champs = []
for c in base.auto_search_champs.values():
for champ in c:
if champ not in champs:
champs.append(champ)
for champ in champs:
coul_champ = coul(champ, "bleu")
if accu == "":
accu = coul_champ
longueur = len(champ)
elif longueur + 2 + len(champ) < 80:
longueur += 2 + len(champ)
accu += ", " + coul_champ
else:
liste.append(accu)
accu = coul_champ
longueur = len(champ)
# Champs manuels
champs = []
for c in base.non_auto_search_champs.values():
for champ in c:
if champ not in champs:
champs.append(champ)
for champ in champs:
if longueur + 2 + len(champ) < 80:
longueur += 2 + len(champ)
accu += ", " + champ
else:
liste.append(accu)
accu = champ
longueur = len(champ)
# Dernière ligne
liste.append(accu)
print __doc__ % { 'prog' : sys.argv[0].split('/')[-1].split('.')[0] ,
'champs_rech' : '\n'.join(list) ,
'champs_rech' : '\n'.join(liste) ,
'limit_aff_details' : limit_aff_details ,
'limit_aff_historique' : limit_aff_historique }
sys.exit(0)