[Apt-offline-devel] [SCM] Offline APT Package Manager branch, master, updated. 0.9.4-5-gf045c27

Ritesh Raj Sarraf rrs at researchut.com
Sat Oct 17 18:55:09 UTC 2009


The following commit has been merged in the master branch:
commit 29239f3c7079fb612f1594e1390a3d82ddc6104b
Author: Ritesh Raj Sarraf <rrs at researchut.com>
Date:   Sun Oct 18 00:19:49 2009 +0530

    Show full count of the items that are to be downloaded
    
    The completed number doesn't account the failed downloads.

diff --git a/AptOfflineCoreLib.py b/AptOfflineCoreLib.py
index 6d9275a..4d64d4b 100644
--- a/AptOfflineCoreLib.py
+++ b/AptOfflineCoreLib.py
@@ -212,9 +212,9 @@ class DownloadFromWeb(AptOfflineLib.ProgressBar):
         This class also inherits progressbar functionalities from
         parent class, ProgressBar'''
         
-        def __init__(self, width, total_itmes):
+        def __init__(self, width, total_items):
                 '''width = Progress Bar width'''
-                AptOfflineLib.ProgressBar.__init__(self, width=width, total_items)
+                AptOfflineLib.ProgressBar.__init__(self, width=width, total_items=total_items)
         
         def download_from_web(self, url, file, download_dir):
                 '''url = url to fetch
@@ -435,7 +435,7 @@ def fetcher( args ):
         
         class FetcherClass( DownloadFromWeb, AptOfflineLib.Archiver, AptOfflineLib.Checksum ):
                 def __init__( self, width, lock, total_items ):
-                        DownloadFromWeb.__init__( self, width=width, total_items )
+                        DownloadFromWeb.__init__( self, width=width, total_items=total_items )
                         #ProgressBar.__init__(self, width)
                         #self.width = width
                         AptOfflineLib.Archiver.__init__( self, lock=lock )
@@ -505,10 +505,10 @@ def fetcher( args ):
         
         # INFO: Let's get the total number of items. This will get the
         # correct total count in the progress bar.
-        total_items = len(FetchData.keys() )
+        total_items = len(FetchData['Item'])
         
         #global FetcherInstance
-        FetcherInstance = FetcherClass( width=30, lock=True, total_items )
+        FetcherInstance = FetcherClass( width=30, lock=True, total_items=total_items )
         
         #INFO: Thread Support
         if Int_NumOfThreads > 2:
diff --git a/AptOfflineLib.py b/AptOfflineLib.py
index 151c03d..c808f43 100644
--- a/AptOfflineLib.py
+++ b/AptOfflineLib.py
@@ -284,10 +284,12 @@ class ProgressBar( object ):
             
                 self.value = self.min
                 
-                if total_items is None:
+                if total_items is None or total_items <= 0:
                         self.items = 0 #count of items being tracked
+                        self.items_update = True
                 else:
                         self.items = total_items
+                        self.items_update = False
                         
                 self.complete = 0
         
@@ -310,7 +312,8 @@ class ProgressBar( object ):
         def addItem( self, maxValue ):
                 self.max = self.max + maxValue
                 self.span = float( self.max - self.min )
-                #self.items = self.items + 1
+                if self.items_update is True:
+                        self.items = self.items + 1
                 self.display()
         
         def display( self ):

-- 
Offline APT Package Manager



More information about the Apt-offline-devel mailing list