r283 - in branches/rewrite: . src

Otavio Salvador partial-mirror-devel@lists.alioth.debian.org
Wed, 10 Nov 2004 09:39:41 -0700


Author: otavio
Date: Wed Nov 10 09:39:40 2004
New Revision: 283

Modified:
   branches/rewrite/   (props changed)
   branches/rewrite/src/DisplayInfo.py
Log:
 r207@nurf:  otavio | 2004-11-10T16:36:51.109942Z
 Add done and failed methods; Fix sintax to work.


Modified: branches/rewrite/src/DisplayInfo.py
==============================================================================
--- branches/rewrite/src/DisplayInfo.py	(original)
+++ branches/rewrite/src/DisplayInfo.py	Wed Nov 10 09:39:40 2004
@@ -27,17 +27,29 @@
             self._info_windows.append(window)
 
     def remove(self, window):
-        if windows in self._info_windows:
+        if window in self._info_windows:
             self._info_windows.remove(window)
             
     def refresh(self):
         map(lambda x: x.refresh(), self._info_windows)
 
+    def done(self, file):
+        pass
+
+    def failed(self, file):
+        pass
+
 class TextDisplayInfo(BaseDisplayInfo):
     def refresh(self):
-        sys.stdout.write('\r')
+        sys.stdout.write('\r' + (" "*80) + '\r')
         BaseDisplayInfo.refresh(self)
 
+    def done(self, file):
+        sys.stdout.write("\rDone: %s\n" % file)
+
+    def failed(self, file):
+        sys.stdout.write("\rFailed: %s\n" % file)
+
 class TextProgressBar:
     def __init__(self, min=0, max=100, text=''):
         self.min = min
@@ -47,11 +59,8 @@
 
     def refresh(self):
         try:
-            sys.stdout.write("[%s: %.2f%%]" % (os.path.basename(self.text).split('_')[0]),
-                             self.current*100/(self.max - self.min))
-##      I am not sure if we had to print to stderr or stdout..            
-##             sys.stderr.write("[%s: %.2f%%]" % (os.path.basename(self.text).split('_')[0]),
-##                              self.current*100/(self.max - self.min))
+            sys.stdout.write("[%s: %.2f%%]" % (os.path.basename(self.text).split('_')[0],
+                                               self.current*100/(self.max - self.min)))
         except ZeroDivisionError:
             pass