[yum-commits] Branch 'yum-3_2_X' - output.py
James Antill
james at osuosl.org
Mon Oct 27 17:27:32 UTC 2008
output.py | 33 ++++++++++++++++++++++++++++++++-
1 file changed, 32 insertions(+), 1 deletion(-)
New commits:
commit 6811a8bac70d3ee917df36d9f3911acf56a2d425
Author: James Antill <james at and.org>
Date: Mon Oct 27 13:27:22 2008 -0400
Underflow for utf8 width in progressbar, too
diff --git a/output.py b/output.py
index f644e44..502aa4b 100644
--- a/output.py
+++ b/output.py
@@ -1206,6 +1206,8 @@ def progressbar(current, total, name=None):
if name is None and current == total:
name = '-'
+ if name is not None: # FIXME: This is a hack without utf8_width()
+ width -= len(to_utf8(name)) - len(name)
end = ' %d/%d' % (current, total)
width -= len(end) + 1
@@ -1278,12 +1280,35 @@ if __name__ == "__main__":
cb.event("lpkg" + "-=" * 15 + ".end", "bar", i, 100, i, 100)
time.sleep(0.1)
- if len(sys.argv) > 1 and sys.argv[1] in ("progress", "rpm-progress",
+ if len(sys.argv) > 1 and sys.argv[1] in ("progress", "i18n-progress",
+ "rpm-progress",
'i18n-rpm-progress'):
yum.misc.setup_locale()
+ if len(sys.argv) > 1 and sys.argv[1] in ("progress", "i18n-progress"):
+ print ""
+ print " Doing progress, i18n: small name"
+ print ""
+ for i in xrange(0, 101):
+ progressbar(i, 100, to_unicode('\xe6\xad\xa3\xe5\x9c\xa8\xe5\xae\x89\xe8\xa3\x85'))
+ time.sleep(0.1)
+ print ""
+
+ print ""
+ print " Doing progress, i18n: big name"
+ print ""
+ for i in xrange(0, 101):
+ progressbar(i, 100, to_unicode('\xe6\xad\xa3\xe5\x9c\xa8\xe5\xae\x89\xe8\xa3\x85' * 5 + ".end"))
+ time.sleep(0.1)
+ print ""
+
+
+ if len(sys.argv) > 1 and sys.argv[1] in ("progress", "i18n-progress",
+ "rpm-progress",
+ 'i18n-rpm-progress'):
cb = YumCliRPMCallBack()
cb.output = True
cb.action["foo"] = to_unicode('\xe6\xad\xa3\xe5\x9c\xa8\xe5\xae\x89\xe8\xa3\x85')
+ cb.action["bar"] = cb.action["foo"] * 5 + ".end"
print ""
print " Doing CB, i18n: small proc / small pkg"
print ""
@@ -1291,4 +1316,10 @@ if __name__ == "__main__":
cb.event("spkg", "foo", i, 100, i, 100)
time.sleep(0.1)
print ""
+ print " Doing CB, i18n: big proc / big pkg"
+ print ""
+ for i in xrange(0, 101):
+ cb.event("lpkg" + "-=" * 15 + ".end", "bar", i, 100, i, 100)
+ time.sleep(0.1)
+ print ""
More information about the Yum-commits
mailing list