[Apt-offline-devel] [SCM] Offline APT Package Manager branch, apt-offline-qt, updated. v0.9.9-110-gdeef88f

Abhishek ideamonk at gmail.com
Sat Aug 21 15:40:03 UTC 2010


The following commit has been merged in the apt-offline-qt branch:
commit 24370d662f0517c7ce0fc499abca9c80c4ae03b2
Author: Abhishek <ideamonk at gmail.com>
Date:   Sun Mar 7 05:26:30 2010 +0530

    real progress working, also fetched missing update file sizes to show progress, less time consuming than earlier implementation

diff --git a/apc.sig b/apc.sig
index 41ed640..e241b43 100644
--- a/apc.sig
+++ b/apc.sig
@@ -44,3 +44,4 @@
 'http://ppa.launchpad.net/rvm/mplayer/ubuntu/dists/karmic/main/source/Sources.bz2' ppa.launchpad.net_rvm_mplayer_ubuntu_dists_karmic_main_source_Sources 0 :
 'http://ppa.launchpad.net/rvm/mplayer/ubuntu/dists/karmic/Release' ppa.launchpad.net_rvm_mplayer_ubuntu_dists_karmic_Release 0 
 'http://ppa.launchpad.net/rvm/mplayer/ubuntu/dists/karmic/Release.gpg' ppa.launchpad.net_rvm_mplayer_ubuntu_dists_karmic_Release.gpg 0 
+'http://ubuntuarchive.hnsdc.com/pool/universe/g/giggle/giggle_0.4.91-1_i386.deb' giggle_0.4.91-1_i386.deb 225826 SHA256:dfe8abc5b8e49a094003760d95cb4b187bc0b3129008918966efa7761939b061
diff --git a/apt_offline_core/AptOfflineCoreLib.py b/apt_offline_core/AptOfflineCoreLib.py
index de5561d..6955d73 100644
--- a/apt_offline_core/AptOfflineCoreLib.py
+++ b/apt_offline_core/AptOfflineCoreLib.py
@@ -55,7 +55,6 @@ import AptOfflineMagicLib
 #INFO: added to store progressbar info
 guiBool = False
 totalSize = [0,0]             # total_size, current_total
-totalUrls = [0,0]             # total items, current count of header fetched ones
 
 #INFO: Check if python-apt is installed
 PythonApt = True
@@ -258,8 +257,7 @@ class GenericDownloadFunction():
                                 counter += 1
                                 self.updateValue(increment)
                                 #REAL_PROGRESS: update current total in totalSize
-                                if guiBool:
-                                    totalSize[1] += block_size
+                                totalSize[1] += block_size
                                 
                         self.completed()
                         
@@ -764,20 +762,20 @@ def fetcher( args ):
         
         #REAL_PROGRESS: to calculate the total download size, NOTE: initially this was under the loop that Queued the items
         if guiBool:
-            log.msg("META_START\n")
-            for key in FetchData.keys():
-                totalUrls[0] = len(FetchData.get(key))
-
             for key in FetchData.keys():
                 for item in FetchData.get(key):
-                    (url, file, download_size, checksum) = stripper(item)
-                    temp = urllib2.urlopen(url)
-                    headers = temp.info()
-                    size = int(headers['Content-Length'])
-                    totalSize[0] += size
-                    totalUrls[1]+=1
-                    log.msg(" _META_ ")
-            log.msg("META_END\n")
+                    try:
+                        (url, file, download_size, checksum) = stripper(item)
+                        size = int(download_size)
+                        if size == 0:
+                            log.msg("MSG_START")
+                            temp = urllib2.urlopen(url)
+                            headers = temp.info()
+                            size = int(headers['Content-Length'])
+                        totalSize[0] += size
+                    except:
+                        ''' some int parsing problem '''
+            log.msg("MSG_END")
                 
         # Queue up the requests.
         #for item in raw_data_list: requestQueue.put(item)
diff --git a/apt_offline_gui/AptOfflineQtFetch.py b/apt_offline_gui/AptOfflineQtFetch.py
index adf112b..ca6089f 100644
--- a/apt_offline_gui/AptOfflineQtFetch.py
+++ b/apt_offline_gui/AptOfflineQtFetch.py
@@ -32,7 +32,14 @@ class Worker(QtCore.QThread):
     def write(self, text):
         # redirects console output to our consoleOutputHolder
         # extract chinese whisper from text
-        if (" / " in text):
+        if ("MSG_START" in text):
+            self.emit (QtCore.SIGNAL('status(QString)'), "Fetching missing meta data ...")
+            return
+        if ("MSG_END" in text):
+            self.emit (QtCore.SIGNAL('status(QString)'), "Downloading packages ...")
+            return
+            
+        if ("[" in text and "]" in text):
             try:
                 # no more splits, we know the exact byte count now
                 progress = str(apt_offline_core.AptOfflineCoreLib.totalSize[1])
@@ -41,19 +48,6 @@ class Worker(QtCore.QThread):
                 return
             except:
                 ''' nothing to do '''
-        
-        if " _META_ " in text:
-            progress = str(apt_offline_core.AptOfflineCoreLib.totalUrls[1])
-            total = str(apt_offline_core.AptOfflineCoreLib.totalUrls[0])
-            self.emit (QtCore.SIGNAL('progress(QString,QString)'), progress,total)
-            return
-            
-        if "META_START" in text:
-            self.emit (QtCore.SIGNAL('status(QString)'), 'Fetching metadata...')
-            return
-        if "META_END" in text:
-            self.emit (QtCore.SIGNAL('status(QString)'), 'Downloading packages...')
-            return
             
         self.emit (QtCore.SIGNAL('output(QString)'), text)
 

-- 
Offline APT Package Manager



More information about the Apt-offline-devel mailing list