[Pkg-privacy-commits] [tails-installer] 138/210: Improve downloads for variants

Intrigeri intrigeri at moszumanska.debian.org
Wed May 24 15:26:38 UTC 2017


This is an automated email from the git hooks/post-receive script.

intrigeri pushed a commit to tag 3.90.0
in repository tails-installer.

commit dbe03a15dc655babed8e5b87775d5a68819241cb
Author: Martin Briza <mbriza at redhat.com>
Date:   Mon Aug 24 17:31:08 2015 +0200

    Improve downloads for variants
---
 liveusb/components/DownloadDialog.qml |  8 ++++++--
 liveusb/components/ImageDetails.qml   |  4 ++++
 liveusb/gui.py                        | 20 +++++++++++---------
 3 files changed, 21 insertions(+), 11 deletions(-)

diff --git a/liveusb/components/DownloadDialog.qml b/liveusb/components/DownloadDialog.qml
index ec65b38..b9f6e31 100644
--- a/liveusb/components/DownloadDialog.qml
+++ b/liveusb/components/DownloadDialog.qml
@@ -13,11 +13,15 @@ Dialog {
 
     width: 640
 
+    function reset() {
+        writeImmediately.confirmed = false
+        acceptButton.pressedOnce = false
+    }
+
     Connections {
         target: liveUSBData
         onCurrentImageChanged: {
-            writeImmediately.confirmed = false
-            acceptButton.pressedOnce = false
+            reset();
         }
     }
 
diff --git a/liveusb/components/ImageDetails.qml b/liveusb/components/ImageDetails.qml
index 1d18ba1..e600373 100644
--- a/liveusb/components/ImageDetails.qml
+++ b/liveusb/components/ImageDetails.qml
@@ -205,6 +205,10 @@ Item {
     }
     DownloadDialog {
         id: dlDialog
+        onVisibleChanged: {
+            //if (!visible)
+            //    liveUSBData.currentImage.
+        }
     }
     FileDialog {
         id: fileDialog
diff --git a/liveusb/gui.py b/liveusb/gui.py
index e1a1496..ad75f9f 100755
--- a/liveusb/gui.py
+++ b/liveusb/gui.py
@@ -74,18 +74,17 @@ class ReleaseDownloadThread(QThread):
     downloadFinished = pyqtSignal(str)
     downloadError = pyqtSignal(str)
 
-    def __init__(self, url, progress, proxies):
+    def __init__(self, progress, proxies):
         QThread.__init__(self)
-        self.url = url
         self.progress = progress
         self.proxies = proxies
 
     def run(self):
         self.grabber = URLGrabber(progress_obj=self.progress, proxies=self.proxies)
         home = os.getenv('HOME', 'USERPROFILE')
-        filename = os.path.basename(urlparse.urlparse(self.url).path)
+        filename = os.path.basename(urlparse.urlparse(self.progress.release.url).path)
         try:
-            iso = self.grabber.urlgrab(self.url, reget='simple')
+            iso = self.grabber.urlgrab(self.progress.release.url, reget='simple')
         except URLGrabError, e:
             # TODO find out if this errno is _really_ benign
             if e.errno == 9: # Requested byte range not satisfiable.
@@ -111,7 +110,8 @@ class ReleaseDownload(QObject, BaseMeter):
 
     def __init__(self, parent):
         QObject.__init__(self, parent)
-        self._grabber = ReleaseDownloadThread(parent.url, self, parent.live.get_proxies())
+        self.release = parent
+        self._grabber = ReleaseDownloadThread(self, parent.live.get_proxies())
 
     def reset(self):
         self._running = False
@@ -566,9 +566,11 @@ class Release(QObject):
 
     @pyqtProperty(str, constant=True)
     def url(self):
-        if 'x86_64' in self._data['variants'].keys():
-            return self._data['variants']['x86_64']['url']
-        return self._data['variants']['']['url']
+        if not self.isLocal:
+            for arch in self._data['variants'].keys():
+                if arch in self._archMap[self.liveUSBData.releaseProxyModel.archFilter]:
+                    return self._data['variants'][arch]['url']
+        return ''
 
     @pyqtProperty(str, notify=pathChanged)
     def path(self):
@@ -580,7 +582,7 @@ class Release(QObject):
             value = value.replace('file://', '', 1)
         if self._path != value:
             self._download.path = value
-            self.pathChanged.emit();
+            self.pathChanged.emit()
             self.size = self.live.isosize
 
     @pyqtProperty(bool, notify=pathChanged)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/tails-installer.git



More information about the Pkg-privacy-commits mailing list