[Pkg-bazaar-commits] ./bzr/unstable r655: - better calculation of progress bar position
Martin Pool
mbp at sourcefrog.net
Fri Apr 10 08:20:36 UTC 2009
------------------------------------------------------------
revno: 655
committer: Martin Pool <mbp at sourcefrog.net>
timestamp: Fri 2005-06-10 17:22:19 +1000
message:
- better calculation of progress bar position
modified:
bzrlib/progress.py
-------------- next part --------------
=== modified file 'bzrlib/progress.py'
--- a/bzrlib/progress.py 2005-06-10 07:17:04 +0000
+++ b/bzrlib/progress.py 2005-06-10 07:22:19 +0000
@@ -35,6 +35,9 @@
# indicators, preferably without needing to adjust all code that
# potentially calls them.
+# TODO: Perhaps don't write updates faster than a certain rate, say
+# 5/second.
+
import sys
import datetime
@@ -156,7 +159,7 @@
cols = _width() - 3 - len(f)
if start_time is not None:
cols -= len(eta_str)
- markers = int (float(cols) * progress.current / progress.total)
+ markers = int(round(float(cols) * progress.current / progress.total))
txt = fmt % (progress.current, progress.total, progress.units,
progress.percent)
to_file.write("\r[%s%s]%s%s" % ('='*markers, ' '*(cols-markers), txt,
More information about the Pkg-bazaar-commits
mailing list