aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Dolbec <dolsen@gentoo.org>2012-07-09 17:04:14 -0700
committerZac Medico <zmedico@gentoo.org>2012-07-09 17:11:02 -0700
commit0623e44a500125064525413404948af9179747a9 (patch)
treea620165c29701f9b7a7d3e789992f596cc9e2ef8
parentTermProgressBar: Fix to do 80 chars (not 81) (diff)
downloadportage-0623e44a500125064525413404948af9179747a9.tar.gz
portage-0623e44a500125064525413404948af9179747a9.tar.bz2
portage-0623e44a500125064525413404948af9179747a9.zip
fix a couple more inconsistancies in the progessbar title, label changes.
-rw-r--r--pym/portage/output.py18
1 files changed, 7 insertions, 11 deletions
diff --git a/pym/portage/output.py b/pym/portage/output.py
index 507adb0ba..75503917b 100644
--- a/pym/portage/output.py
+++ b/pym/portage/output.py
@@ -733,7 +733,7 @@ class TermProgressBar(ProgressBar):
curval = self._curval
maxval = self._maxval
position = self._position
- percentage_str_width = 4
+ percentage_str_width = 5
square_brackets_width = 2
if cols < percentage_str_width:
return ""
@@ -742,7 +742,7 @@ class TermProgressBar(ProgressBar):
bar_space -= self._desc_max_length
if maxval == 0:
max_bar_width = bar_space-3
- image = " "
+ _percent = "".ljust(percentage_str_width)
if cols < min_columns:
return image
if position <= 0.5:
@@ -760,19 +760,15 @@ class TermProgressBar(ProgressBar):
position = 0.5
self._position = position
bar_width = int(offset * max_bar_width)
- image = image + "[" + (bar_width * " ") + \
- "<=>" + ((max_bar_width - bar_width) * " ") + "]"
+ image = "%s%s%s" % (self._desc, _percent,
+ "[" + (bar_width * " ") + \
+ "<=>" + ((max_bar_width - bar_width) * " ") + "]")
return image
else:
percentage = int(100 * float(curval) / maxval)
- if percentage == 100:
- percentage_str_width += 1
- bar_space -= 1
max_bar_width = bar_space - 1
- image = "%s%s" % (
- self._desc,
- ("%d%%" % percentage).ljust(percentage_str_width),
- )
+ _percent = ("%d%% " % percentage).rjust(percentage_str_width)
+ image = "%s%s" % (self._desc, _percent)
if cols < min_columns:
return image