1 |
commit: 0623e44a500125064525413404948af9179747a9 |
2 |
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Jul 10 00:04:14 2012 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Jul 10 00:11:02 2012 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=0623e44a |
7 |
|
8 |
fix a couple more inconsistancies in the progessbar title, label changes. |
9 |
|
10 |
--- |
11 |
pym/portage/output.py | 18 +++++++----------- |
12 |
1 files changed, 7 insertions(+), 11 deletions(-) |
13 |
|
14 |
diff --git a/pym/portage/output.py b/pym/portage/output.py |
15 |
index 507adb0..7550391 100644 |
16 |
--- a/pym/portage/output.py |
17 |
+++ b/pym/portage/output.py |
18 |
@@ -733,7 +733,7 @@ class TermProgressBar(ProgressBar): |
19 |
curval = self._curval |
20 |
maxval = self._maxval |
21 |
position = self._position |
22 |
- percentage_str_width = 4 |
23 |
+ percentage_str_width = 5 |
24 |
square_brackets_width = 2 |
25 |
if cols < percentage_str_width: |
26 |
return "" |
27 |
@@ -742,7 +742,7 @@ class TermProgressBar(ProgressBar): |
28 |
bar_space -= self._desc_max_length |
29 |
if maxval == 0: |
30 |
max_bar_width = bar_space-3 |
31 |
- image = " " |
32 |
+ _percent = "".ljust(percentage_str_width) |
33 |
if cols < min_columns: |
34 |
return image |
35 |
if position <= 0.5: |
36 |
@@ -760,19 +760,15 @@ class TermProgressBar(ProgressBar): |
37 |
position = 0.5 |
38 |
self._position = position |
39 |
bar_width = int(offset * max_bar_width) |
40 |
- image = image + "[" + (bar_width * " ") + \ |
41 |
- "<=>" + ((max_bar_width - bar_width) * " ") + "]" |
42 |
+ image = "%s%s%s" % (self._desc, _percent, |
43 |
+ "[" + (bar_width * " ") + \ |
44 |
+ "<=>" + ((max_bar_width - bar_width) * " ") + "]") |
45 |
return image |
46 |
else: |
47 |
percentage = int(100 * float(curval) / maxval) |
48 |
- if percentage == 100: |
49 |
- percentage_str_width += 1 |
50 |
- bar_space -= 1 |
51 |
max_bar_width = bar_space - 1 |
52 |
- image = "%s%s" % ( |
53 |
- self._desc, |
54 |
- ("%d%%" % percentage).ljust(percentage_str_width), |
55 |
- ) |
56 |
+ _percent = ("%d%% " % percentage).rjust(percentage_str_width) |
57 |
+ image = "%s%s" % (self._desc, _percent) |
58 |
|
59 |
if cols < min_columns: |
60 |
return image |