r272 - in branches/rewrite: . src
Otavio Salvador
partial-mirror-devel@lists.alioth.debian.org
Tue, 09 Nov 2004 17:44:10 -0700
Author: otavio
Date: Tue Nov 9 17:44:10 2004
New Revision: 272
Modified:
branches/rewrite/ (props changed)
branches/rewrite/src/DisplayInfo.py
Log:
r184@nurf: otavio | 2004-11-10T00:40:35.774228Z
Handle float division.
Modified: branches/rewrite/src/DisplayInfo.py
==============================================================================
--- branches/rewrite/src/DisplayInfo.py (original)
+++ branches/rewrite/src/DisplayInfo.py Tue Nov 9 17:44:10 2004
@@ -32,7 +32,7 @@
class TextDisplayInfo(BaseDisplayInfo):
def refresh(self):
sys.stdout.write('\r')
- DisplayInfo.refresh(self)
+ BaseDisplayInfo.refresh(self)
class TextProgressBar:
def __init__(self, min=0, max=100, text=''):
@@ -42,8 +42,9 @@
self.current = min
def refresh(self):
- sys.stdout.write("[ %.2f%% %s]" % (self.current*100/(self.max - self.min), os.path.basename(self.text).split('_')[0]))
- sys.stdout.flush()
+ try:
+ sys.stdout.write("[ %.2f%% %s]" % (self.current*100/(self.max - self.min), os.path.basename(self.text).split('_')[0]))
+ except ZeroDivisionError, e:
+ pass
-DisplayInfo = TextDisplayInfo
-ProgressBar = TextProgressBar
+ sys.stdout.flush()