summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-06-20 10:06:30 +0000
committerZac Medico <zmedico@gentoo.org>2007-06-20 10:06:30 +0000
commit048d0b5a75b5a7432e31ddbd4cd516f2eb071b25 (patch)
tree2eb78837e5a4536926b158f0b0643324aaaf0e71
parentda13aa0be61038b36182ec85c0a59e9f27522147 (diff)
downloadportage-048d0b5a75b5a7432e31ddbd4cd516f2eb071b25.tar.gz
portage-048d0b5a75b5a7432e31ddbd4cd516f2eb071b25.tar.bz2
portage-048d0b5a75b5a7432e31ddbd4cd516f2eb071b25.zip
Make the progress bar percentage indicator stop at 100% instead of just 99%.
svn path=/main/trunk/; revision=6889
-rw-r--r--pym/portage/output.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/pym/portage/output.py b/pym/portage/output.py
index 847e5627a..010c0472f 100644
--- a/pym/portage/output.py
+++ b/pym/portage/output.py
@@ -523,9 +523,11 @@ class TermProgressBar(ProgressBar):
curval = self._curval
maxval = self._maxval
position = self._position
- if cols < 3:
+ percentage_str_width = 4
+ square_brackets_width = 2
+ if cols < percentage_str_width:
return ""
- bar_space = cols - 6
+ bar_space = cols - percentage_str_width - square_brackets_width
if maxval == 0:
max_bar_width = bar_space-3
image = " "
@@ -550,11 +552,12 @@ class TermProgressBar(ProgressBar):
"<=>" + ((max_bar_width - bar_width) * " ") + "]"
return image
else:
- max_bar_width = bar_space-1
percentage = int(100 * float(curval) / maxval)
if percentage == 100:
- percentage = 99
- image = ("%d%% " % percentage).rjust(4)
+ percentage_str_width += 1
+ bar_space -= 1
+ max_bar_width = bar_space - 1
+ image = ("%d%% " % percentage).rjust(percentage_str_width)
if cols < min_columns:
return image
offset = float(curval) / maxval