[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:02 UTC 2010
The following commit has been merged in the apt-offline-qt branch:
commit 6c4e1c8db7a8ffe678c1c0721c995a503cddb9dc
Author: Abhishek <ideamonk at gmail.com>
Date: Sun Mar 7 03:45:38 2010 +0530
real progress bar works, but some odd changes to core lib, trying to find a better way
diff --git a/apt_offline_core/AptOfflineCoreLib.py b/apt_offline_core/AptOfflineCoreLib.py
index 063eae6..de5561d 100644
--- a/apt_offline_core/AptOfflineCoreLib.py
+++ b/apt_offline_core/AptOfflineCoreLib.py
@@ -52,7 +52,10 @@ except ImportError:
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
@@ -254,7 +257,12 @@ class GenericDownloadFunction():
i += block_size
counter += 1
self.updateValue(increment)
+ #REAL_PROGRESS: update current total in totalSize
+ if guiBool:
+ totalSize[1] += block_size
+
self.completed()
+
data.close()
temp.close()
return True
@@ -754,6 +762,23 @@ def fetcher( args ):
# Start the threads.
for t in thread_pool: t.start()
+ #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")
+
# Queue up the requests.
#for item in raw_data_list: requestQueue.put(item)
for key in FetchData.keys():
diff --git a/apt_offline_gui/AptOfflineQtFetch.py b/apt_offline_gui/AptOfflineQtFetch.py
index d0e4ee2..adf112b 100644
--- a/apt_offline_gui/AptOfflineQtFetch.py
+++ b/apt_offline_gui/AptOfflineQtFetch.py
@@ -32,16 +32,29 @@ class Worker(QtCore.QThread):
def write(self, text):
# redirects console output to our consoleOutputHolder
# extract chinese whisper from text
-
if (" / " in text):
try:
- progress,total = text.split(" / ",1)
- progress = progress.strip()
- total = total.split(" ",1)[0].strip()
+ # no more splits, we know the exact byte count now
+ progress = str(apt_offline_core.AptOfflineCoreLib.totalSize[1])
+ total = str(apt_offline_core.AptOfflineCoreLib.totalSize[0])
self.emit (QtCore.SIGNAL('progress(QString,QString)'), progress,total)
+ 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)
def flush(self):
@@ -87,6 +100,11 @@ class AptOfflineQtFetch(QtGui.QDialog):
self.updateLog )
QtCore.QObject.connect(self.worker, QtCore.SIGNAL("progress(QString,QString)"),
self.updateProgress )
+ QtCore.QObject.connect(self.worker, QtCore.SIGNAL("status(QString)"),
+ self.updateStatus )
+
+ #INFO: inform CLI that it's a gui app
+ apt_offline_core.AptOfflineCoreLib.guiBool = True
def popupDirectoryDialog(self):
# Popup a Directory selection box
@@ -168,9 +186,13 @@ class AptOfflineQtFetch(QtGui.QDialog):
if ('Downloaded data ' in text):
guicommon.updateInto (self.ui.rawLogHolder,
guicommon.style(text,'green_fin'))
+ self.ui.progressStatusDescription.setText('Finished.')
else:
guicommon.updateInto (self.ui.rawLogHolder,text)
+ def updateStatus(self,text):
+ self.ui.progressStatusDescription.setText(text)
+
def updateProgress(self,progress,total):
try:
# try parsing numbers and updating progressBar
diff --git a/apt_offline_gui/AptOfflineQtFetch.ui b/apt_offline_gui/AptOfflineQtFetch.ui
index 8797669..7d74388 100644
--- a/apt_offline_gui/AptOfflineQtFetch.ui
+++ b/apt_offline_gui/AptOfflineQtFetch.ui
@@ -160,8 +160,8 @@
<rect>
<x>90</x>
<y>210</y>
- <width>53</width>
- <height>15</height>
+ <width>341</width>
+ <height>16</height>
</rect>
</property>
<property name="font">
diff --git a/apt_offline_gui/Ui_AptOfflineQtAbout.py b/apt_offline_gui/Ui_AptOfflineQtAbout.py
index c85f81f..9dc7fbb 100644
--- a/apt_offline_gui/Ui_AptOfflineQtAbout.py
+++ b/apt_offline_gui/Ui_AptOfflineQtAbout.py
@@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'AptOfflineQtAbout.ui'
#
-# Created: Sun Mar 7 00:22:12 2010
+# Created: Sun Mar 7 03:28:04 2010
# by: PyQt4 UI code generator 4.6
#
# WARNING! All changes made in this file will be lost!
@@ -12,6 +12,7 @@ from PyQt4 import QtCore, QtGui
class Ui_AboutAptOffline(object):
def setupUi(self, AboutAptOffline):
AboutAptOffline.setObjectName("AboutAptOffline")
+ AboutAptOffline.setWindowModality(QtCore.Qt.ApplicationModal)
AboutAptOffline.resize(526, 378)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
diff --git a/apt_offline_gui/Ui_AptOfflineQtCreateProfile.py b/apt_offline_gui/Ui_AptOfflineQtCreateProfile.py
index 3025f14..38e249f 100644
--- a/apt_offline_gui/Ui_AptOfflineQtCreateProfile.py
+++ b/apt_offline_gui/Ui_AptOfflineQtCreateProfile.py
@@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'AptOfflineQtCreateProfile.ui'
#
-# Created: Sun Mar 7 00:22:12 2010
+# Created: Sun Mar 7 03:28:04 2010
# by: PyQt4 UI code generator 4.6
#
# WARNING! All changes made in this file will be lost!
diff --git a/apt_offline_gui/Ui_AptOfflineQtFetch.py b/apt_offline_gui/Ui_AptOfflineQtFetch.py
index 076aab4..3cc1153 100644
--- a/apt_offline_gui/Ui_AptOfflineQtFetch.py
+++ b/apt_offline_gui/Ui_AptOfflineQtFetch.py
@@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'AptOfflineQtFetch.ui'
#
-# Created: Sun Mar 7 00:22:12 2010
+# Created: Sun Mar 7 03:28:04 2010
# by: PyQt4 UI code generator 4.6
#
# WARNING! All changes made in this file will be lost!
@@ -60,7 +60,7 @@ class Ui_AptOfflineQtFetch(object):
self.label_2.setFont(font)
self.label_2.setObjectName("label_2")
self.progressStatusDescription = QtGui.QLabel(AptOfflineQtFetch)
- self.progressStatusDescription.setGeometry(QtCore.QRect(90, 210, 53, 15))
+ self.progressStatusDescription.setGeometry(QtCore.QRect(90, 210, 341, 16))
font = QtGui.QFont()
font.setPointSize(10)
self.progressStatusDescription.setFont(font)
diff --git a/apt_offline_gui/Ui_AptOfflineQtInstall.py b/apt_offline_gui/Ui_AptOfflineQtInstall.py
index cab073f..cb135f7 100644
--- a/apt_offline_gui/Ui_AptOfflineQtInstall.py
+++ b/apt_offline_gui/Ui_AptOfflineQtInstall.py
@@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'AptOfflineQtInstall.ui'
#
-# Created: Sun Mar 7 00:22:12 2010
+# Created: Sun Mar 7 03:28:04 2010
# by: PyQt4 UI code generator 4.6
#
# WARNING! All changes made in this file will be lost!
diff --git a/apt_offline_gui/Ui_AptOfflineQtMain.py b/apt_offline_gui/Ui_AptOfflineQtMain.py
index 53bebba..2e28f7c 100644
--- a/apt_offline_gui/Ui_AptOfflineQtMain.py
+++ b/apt_offline_gui/Ui_AptOfflineQtMain.py
@@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'AptOfflineQtMain.ui'
#
-# Created: Sun Mar 7 00:22:12 2010
+# Created: Sun Mar 7 03:28:04 2010
# by: PyQt4 UI code generator 4.6
#
# WARNING! All changes made in this file will be lost!
--
Offline APT Package Manager
More information about the Apt-offline-devel
mailing list