summaryrefslogtreecommitdiff
path: root/shellutils.py
diff options
context:
space:
mode:
authorPierre-Yves David <pierre-yves.david@logilab.fr>2008-06-27 11:29:17 +0200
committerPierre-Yves David <pierre-yves.david@logilab.fr>2008-06-27 11:29:17 +0200
commit9c2bba4cc83f9ca438d409370b4bc4b5083f363c (patch)
treec52f507cf320e2ed441653313329fb028589d2da /shellutils.py
parente786216e23171f10052cf046e932f0a1a848b349 (diff)
downloadlogilab-common-9c2bba4cc83f9ca438d409370b4bc4b5083f363c.tar.gz
prevent progress bar flicking
Diffstat (limited to 'shellutils.py')
-rw-r--r--shellutils.py7
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()