From 8cd622fe855c93c16f01a31d95418ba7ba539377 Mon Sep 17 00:00:00 2001 From: Pierre-Yves David Date: Thu, 26 Jun 2008 17:43:36 +0200 Subject: fix a bug in shellutils.ProgressBar --- shellutils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'shellutils.py') diff --git a/shellutils.py b/shellutils.py index dd9207f..70f5c4b 100644 --- a/shellutils.py +++ b/shellutils.py @@ -193,7 +193,7 @@ class ProgressBar(object): def __init__(self, nbops, size=20., stream=sys.stdout): self._dotevery = max(nbops / size, 1) - self._fstr = '\r[%-20s]' + self._fstr = '\r[%%-%ss]' % size self._dotcount, self._dots = 1, [] self._stream = stream @@ -201,7 +201,7 @@ class ProgressBar(object): """update the progression bar""" self._dotcount += 1 if self._dotcount >= self._dotevery: - self._dotcount = 1 + self._dotcount = 0 self._dots.append('.') self._stream.write(self._fstr % ''.join(self._dots)) self._stream.flush() -- cgit v1.2.1