Skip to content

Commit

Permalink
Use the progress bar in run command
Browse files Browse the repository at this point in the history
  • Loading branch information
kfsone committed Feb 14, 2015
1 parent 0daf65c commit 3589a22
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tradecalc.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import locale
import math
import os
import misc.progress as pbar
import time

locale.setlocale(locale.LC_ALL, '')
Expand Down Expand Up @@ -745,7 +746,10 @@ def getBestHops(self, routes, restrictTo=None):
restrictStations.update(place.stations)
restrictStations = set(restrictStations)

prog = pbar.Progress(len(routes), 25)
for route in routes:
if tdenv.progress:
prog.increment(1)
tdenv.DEBUG1("Route = {}", route.str())

srcStation = route.route[-1]
Expand Down Expand Up @@ -890,6 +894,8 @@ def considerStation(dstStation, dest, multiplier):
if not restricting:
break

prog.clear()

result = []
for (dst, route, trade, jumps, ly, score) in bestToDest.values():
result.append(route.plus(dst, trade, jumps, score))
Expand Down

0 comments on commit 3589a22

Please sign in to comment.