diff options
author | Pierre-Yves David <pierre-yves.david@logilab.fr> | 2008-06-27 11:29:17 +0200 |
---|---|---|
committer | Pierre-Yves David <pierre-yves.david@logilab.fr> | 2008-06-27 11:29:17 +0200 |
commit | 9c2bba4cc83f9ca438d409370b4bc4b5083f363c (patch) | |
tree | c52f507cf320e2ed441653313329fb028589d2da /shellutils.py | |
parent | e786216e23171f10052cf046e932f0a1a848b349 (diff) | |
download | logilab-common-9c2bba4cc83f9ca438d409370b4bc4b5083f363c.tar.gz |
prevent progress bar flicking
Diffstat (limited to 'shellutils.py')
-rw-r--r-- | shellutils.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/shellutils.py b/shellutils.py index d855ae5..6f8d929 100644 --- a/shellutils.py +++ b/shellutils.py @@ -197,10 +197,13 @@ class ProgressBar(object): self._total = nbops self._size = size self._current = 0 + self._progress = 0 def update(self): """update the progression bar""" self._current += 1 progress = int((float(self._current)/float(self._total))*self._size) - self._stream.write(self._fstr % ('.' * progress) ) - self._stream.flush() + if progress > self._progress: + self._progress = progress + self._stream.write(self._fstr % ('.' * progress) ) + self._stream.flush() |