[ressucite.py] uncommited changes

darcs-hash:20090916181925-bd074-85ca0a74277c32ac7a5b579d78fb8759d25e47f8.gz
This commit is contained in:
Antoine Durand-Gasselin 2009-09-16 20:19:25 +02:00
parent c831e97cf8
commit c28a245468

View file

@ -221,10 +221,12 @@ def choixadherent(machine, oldadh=None):
# Est-ce que l'adhérent existe encore ?
if (len(oldadhl) > 0 and str(machine.proprio) == "%s %s"
% (oldadhl[0].prenom(), oldadhl[0].nom())):
annul, choix = dlg.menu(u"Le propriétaire de la machine est %s" % machine.proprio,
choices=[("Garder",u"Ajouter à cet adhérent"),
("Autre",u"Ajouter à un autre adhérent")],
title=u"Adhérent auquel rattacher la machine")
# annul, choix = dlg.menu(u"Le propriétaire de la machine est %s" % machine.proprio,
# choices=[("Garder",u"Ajouter à cet adhérent"),
# ("Autre",u"Ajouter à un autre adhérent")],
# title=u"Adhérent auquel rattacher la machine")
annul = False
choix = "Garder"
else:
annul, choix = dlg.menu(u"Cet adhérent n'existe plus dans la base.",
choices=[("Autre",u"Ajouter à un autre adhérent")],
@ -297,19 +299,24 @@ def ressuscite(adh, oldmachine):
# Certaines fois, on peut vouloir transformer une machine Fixe en Wifi,
# et inversement (erreurs d'ajout ...)
annul, choix = dlg.menu(strmachine,
choices=[("Fixe",u"Ressusciter en tant que machine Fixe"),
("Wifi",u"Ressusciter en tant que machine Wifi")],
default_item=strdef,
title=u"Nouveau type de machine")
if annul: return False
if choix == 'Fixe':
# annul, choix = dlg.menu(strmachine,
# choices=[("Fixe",u"Ressusciter en tant que machine Fixe"),
# ("Wifi",u"Ressusciter en tant que machine Wifi")],
# default_item=strdef,
# title=u"Nouveau type de machine")
#
# if annul: return False
#
# if choix == 'Fixe':
# machine = MachineFixe(adh)
# elif choix == 'Wifi':
# machine = MachineWifi(adh)
if strdef == 'Fixe':
machine = MachineFixe(adh)
elif choix == 'Wifi':
elif strdef == 'Wifi':
machine = MachineWifi(adh)
err = ""
# On remet le nom
@ -348,7 +355,9 @@ def ressuscite(adh, oldmachine):
# Des erreurs ?
if err:
dlg.msgbox(text=u"%s" % err,title=u"Paramètres machine")
set_machine(machine)
# set_machine(machine)
machine.save()
return True
@ -430,11 +439,11 @@ if __name__ == '__main__':
os.system("clear")
else:
for path in sys.argv[1:]:
try:
# try:
fichier = open(path, 'r')
machine = cPickle.load(fichier)
adh = choixadherent(machine)
if adh:
ressuscite(adh, machine)
except:
print "Fichier invalide : %s" % fichier
# except:
# print "Fichier invalide : %s" % fichier