[ressuscite.py] Ajout barre de progression
Ignore-this: 28cbb12fb3cd3279dfe38cb8f9e817c9 On s'ennuie pendant qu'il cherche darcs-hash:20111116121012-ddb99-401cce478dd0eb5762a9e64c865446f5b98006b9.gz
This commit is contained in:
parent
f35ff9531c
commit
af7894e07e
1 changed files with 8 additions and 2 deletions
|
@ -192,7 +192,8 @@ def choixrecherche(condition=None):
|
|||
if annul: return None
|
||||
|
||||
# On cherche les machines
|
||||
machines = recherche(choix == 'Fixe' or choix == 'Tous',
|
||||
machines = recherche(dlg,
|
||||
choix == 'Fixe' or choix == 'Tous',
|
||||
choix == 'Wifi' or choix == 'Tous',
|
||||
condition)
|
||||
|
||||
|
@ -204,7 +205,7 @@ def choixrecherche(condition=None):
|
|||
return choixmachine(machines)
|
||||
|
||||
|
||||
def recherche(fixe=False, wifi=False, condition=None):
|
||||
def recherche(dlg, fixe=False, wifi=False, condition=None):
|
||||
"""Recherche des machines du type demandé, et satisfaisant une condition :
|
||||
la fonction condition doit être de la forme
|
||||
condition(machine, date)
|
||||
|
@ -219,6 +220,8 @@ def recherche(fixe=False, wifi=False, condition=None):
|
|||
|
||||
# On regarde chacun des fichiers
|
||||
valid = []
|
||||
done = 0
|
||||
dlg.gauge_start(text="Recherche en cours...")
|
||||
for fichier in cimetiere:
|
||||
try:
|
||||
machine = cPickle.load(open(fichier, 'r'))
|
||||
|
@ -227,6 +230,9 @@ def recherche(fixe=False, wifi=False, condition=None):
|
|||
valid.append((machine, date))
|
||||
except:
|
||||
pass
|
||||
done += 1
|
||||
dlg.gauge_update(int(done*100/len(cimetiere)))
|
||||
dlg.gauge_stop()
|
||||
return valid
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue