Patch for an Issue #584

This commit is contained in:
Miroslav Stampar 2013-12-16 22:00:47 +01:00
parent 5b2ded0b18
commit 4819e19200

View File

@ -20,7 +20,7 @@ class ProgressBar(object):
self._oldProgBar = "" self._oldProgBar = ""
self._min = int(minValue) self._min = int(minValue)
self._max = int(maxValue) self._max = int(maxValue)
self._span = self._max - self._min self._span = max(self._max - self._min, 0.001)
self._width = totalWidth if totalWidth else conf.progressWidth self._width = totalWidth if totalWidth else conf.progressWidth
self._amount = 0 self._amount = 0
self._times = [] self._times = []
@ -49,7 +49,7 @@ class ProgressBar(object):
diffFromMin = float(self._amount - self._min) diffFromMin = float(self._amount - self._min)
percentDone = (diffFromMin / float(self._span)) * 100.0 percentDone = (diffFromMin / float(self._span)) * 100.0
percentDone = round(percentDone) percentDone = round(percentDone)
percentDone = int(percentDone) percentDone = min(100, int(percentDone))
# Figure out how many hash bars the percentage should be # Figure out how many hash bars the percentage should be
allFull = self._width - len("100%% [] %s/%s ETA 00:00" % (self._max, self._max)) allFull = self._width - len("100%% [] %s/%s ETA 00:00" % (self._max, self._max))