Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4819e19

Browse files
committed
Patch for an Issue #584
1 parent 5b2ded0 commit 4819e19

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lib/utils/progress.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def __init__(self, minValue=0, maxValue=10, totalWidth=None):
2020
self._oldProgBar = ""
2121
self._min = int(minValue)
2222
self._max = int(maxValue)
23-
self._span = self._max - self._min
23+
self._span = max(self._max - self._min, 0.001)
2424
self._width = totalWidth if totalWidth else conf.progressWidth
2525
self._amount = 0
2626
self._times = []
@@ -49,7 +49,7 @@ def update(self, newAmount=0):
4949
diffFromMin = float(self._amount - self._min)
5050
percentDone = (diffFromMin / float(self._span)) * 100.0
5151
percentDone = round(percentDone)
52-
percentDone = int(percentDone)
52+
percentDone = min(100, int(percentDone))
5353

5454
# Figure out how many hash bars the percentage should be
5555
allFull = self._width - len("100%% [] %s/%s ETA 00:00" % (self._max, self._max))

0 commit comments

Comments
 (0)