[Pkg-privacy-commits] [torbrowser-launcher] 70/476: Nicer message for the progress-bar

Ximin Luo infinity0 at moszumanska.debian.org
Sat Aug 22 13:21:24 UTC 2015


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch debian
in repository torbrowser-launcher.

commit 44a002d3fcd7a4aa2afdd46bfe45d67ebfb9f14e
Author: meejah <meejah at meejah.ca>
Date:   Thu Feb 21 18:40:23 2013 -0700

    Nicer message for the progress-bar
---
 torbrowser-launcher | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/torbrowser-launcher b/torbrowser-launcher
index 2050f90..5c7aa07 100755
--- a/torbrowser-launcher
+++ b/torbrowser-launcher
@@ -291,7 +291,15 @@ class TorBrowserLauncher:
         self.so_far += len(bytes)
         percent = float(self.so_far) / float(self.total)
         self.progress.set_fraction(percent)
-        self.progress.set_text('Downloaded %2.1f%%' % (percent * 100.0))
+        amount = float(self.so_far)
+        units = "bytes"
+        for (size, unit) in [(1000000, "MB"), (1000, "KB")]:
+          if amount > size:
+            units = unit
+            amount = amount / float(size)
+            break
+
+        self.progress.set_text('Downloaded %2.1f%% (%2.1f %s)' % ((percent * 100.0), amount, units))
 
       def connectionLost(self, reason):
         print 'Finished receiving body:', reason.getErrorMessage()

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/torbrowser-launcher.git



More information about the Pkg-privacy-commits mailing list