Rev 534: Consider 0 a valid value for progress bars. in file:///data/jelmer/bzr-gtk/progressbars/

Jelmer Vernooij jelmer at samba.org
Thu Jul 17 13:46:37 BST 2008


At file:///data/jelmer/bzr-gtk/progressbars/

------------------------------------------------------------
revno: 534
revision-id: jelmer at samba.org-20080717124631-3mhq1n7aytf5wc15
parent: jelmer at samba.org-20080717115103-djh5sb0pvpse2zkb
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: progressbars
timestamp: Thu 2008-07-17 14:46:31 +0200
message:
  Consider 0 a valid value for progress bars.
modified:
  ui.py                          ui.py-20060716163355-owuqwa9uhnlfsojs-1
=== modified file 'ui.py'
--- a/ui.py	2008-06-30 20:32:25 +0000
+++ b/ui.py	2008-07-17 12:46:31 +0000
@@ -58,14 +58,16 @@
         pass
 
     def update(self, msg=None, current_cnt=None, total_cnt=None):
-        if current_cnt:
+        if current_cnt is not None:
             self.current = current_cnt
-        if total_cnt:
+        if total_cnt is not None:
             self.total = total_cnt
         if msg is not None:
             self.set_text(msg)
         if None not in (self.current, self.total):
             self.fraction = float(self.current) / self.total
+            if self.fraction < 0.0 or self.fraction > 1.0:
+                raise AssertionError
             self.set_fraction(self.fraction)
         while gtk.events_pending():
             gtk.main_iteration()




More information about the bazaar-commits mailing list