From 3589a229bc2a645584f270477e26765d750f6523 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Sat, 14 Feb 2015 00:16:11 -0800 Subject: [PATCH] Use the progress bar in run command --- tradecalc.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tradecalc.py b/tradecalc.py index d92618f0..03c40a5c 100644 --- a/tradecalc.py +++ b/tradecalc.py @@ -44,6 +44,7 @@ import locale import math import os +import misc.progress as pbar import time locale.setlocale(locale.LC_ALL, '') @@ -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] @@ -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))