[Pkg-privacy-commits] [tails-installer] 42/210: Filtering now works fully

Intrigeri intrigeri at moszumanska.debian.org
Wed May 24 15:26:26 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 9eed799b5b638801476d15f1ff7ef15d48f50ec1
Author: Martin Briza <mbriza at redhat.com>
Date:   Thu Mar 19 13:34:46 2015 +0100

    Filtering now works fully
---
 liveusb/components/ImageDetails.qml |  1 -
 liveusb/components/ImageList.qml    | 35 +++++++++++++++++++--
 liveusb/gui.py                      | 62 ++++++++++++++++++++++++-------------
 liveusb/releases.py                 | 36 ++++++++++-----------
 4 files changed, 91 insertions(+), 43 deletions(-)

diff --git a/liveusb/components/ImageDetails.qml b/liveusb/components/ImageDetails.qml
index 59df20b..82f1e7b 100644
--- a/liveusb/components/ImageDetails.qml
+++ b/liveusb/components/ImageDetails.qml
@@ -193,7 +193,6 @@ Item {
         id: fileDialog
         nameFilters: [ "Image files (*.iso)", "All files (*)"]
         onAccepted: {
-            console.log(fileUrl)
             liveUSBData.currentImage.path = fileUrl
         }
     }
diff --git a/liveusb/components/ImageList.qml b/liveusb/components/ImageList.qml
index 70d7db7..bd6e0c7 100644
--- a/liveusb/components/ImageList.qml
+++ b/liveusb/components/ImageList.qml
@@ -87,7 +87,8 @@ Item {
                 verticalAlignment: Text.AlignVCenter
             }
             verticalAlignment: TextInput.AlignVCenter
-
+            text: liveUSBData.releaseProxyModel.nameFilter
+            onTextChanged: liveUSBData.releaseProxyModel.nameFilter = text
             clip: true
         }
     }
@@ -111,6 +112,21 @@ Item {
         height: 36
         width: 148
         model: liveUSBData.releaseProxyModel.possibleArchs
+        onCurrentIndexChanged:  {
+            liveUSBData.releaseProxyModel.archFilter = currentText
+        }
+        function update() {
+            for (var i = 0; i < liveUSBData.releaseProxyModel.possibleArchs.length; i++) {
+                if (liveUSBData.releaseProxyModel.possibleArchs[i] == liveUSBData.releaseProxyModel.archFilter)
+                    currentIndex = i
+            }
+        }
+
+        Connections {
+            target: liveUSBData.releaseProxyModel
+            onArchFilterChanged: archSelect.update()
+        }
+        Component.onCompleted: update()
     }
 
     Rectangle {
@@ -225,6 +241,21 @@ Item {
 
             model: liveUSBData.releaseProxyModel
             delegate: imageDelegate
+
+            remove: Transition {
+                NumberAnimation { properties: "x"; to: -width; duration: 300 }
+            }
+            removeDisplaced: Transition {
+                PauseAnimation { duration: 300 }
+                NumberAnimation { properties: "x,y"; duration: 300 }
+            }
+            add: Transition {
+                NumberAnimation { properties: "x"; from: -width; duration: 300 }
+            }
+            addDisplaced: Transition {
+                PauseAnimation { duration: 300 }
+                NumberAnimation { properties: "x,y"; duration: 300 }
+            }
         }
         style: ScrollViewStyle {
             incrementControl: Item {}
@@ -332,7 +363,7 @@ Item {
                     }
                     onClicked: {
                         root.currentIndex = index
-                        root.stepForward(index)
+                        root.stepForward(release.index)
                     }
                     onPressed: {
                         parent.color = "#ededed"
diff --git a/liveusb/gui.py b/liveusb/gui.py
index d2a5f1c..d5840ba 100755
--- a/liveusb/gui.py
+++ b/liveusb/gui.py
@@ -130,7 +130,6 @@ class ReleaseDownload(QObject, BaseMeter):
     def childFinished(self, iso):
         self.path = iso
         self._running = False
-        print(iso)
         self.runningChanged.emit()
 
     @pyqtSlot(str)
@@ -189,7 +188,6 @@ class ReleaseWriterProgressThread(QThread):
 
     def run(self):
         while self.alive:
-            print("ping")
             free = self.get_free_bytes()
             value = (self.orig_free - free) / 1024
             self.parent().progress = value
@@ -419,9 +417,10 @@ class Release(QObject):
     pathChanged = pyqtSignal()
     sizeChanged = pyqtSignal()
 
-    def __init__(self, parent=None, live=None, name = '', logo = '', size = 0, arch = '', fullName = '', releaseDate = QDateTime(), shortDescription = '', fullDescription = '', isLocal = False, screenshots = [], url=''):
+    def __init__(self, parent, index, live=None, name = '', logo = '', size = 0, arch = '', fullName = '', releaseDate = QDateTime(), shortDescription = '', fullDescription = '', isLocal = False, screenshots = [], url=''):
         QObject.__init__(self, parent)
 
+        self._index = index
         self.live = live
         self._name = name.replace('_', ' ')
         self._logo = logo
@@ -479,6 +478,10 @@ class Release(QObject):
     def write(self):
         self._writer.run()
 
+    @pyqtProperty(int, constant=True)
+    def index(self):
+        return self._index
+
     @pyqtProperty(str, constant=True)
     def name(self):
         return self._name
@@ -574,7 +577,7 @@ class ReleaseListModel(QAbstractListModel):
 
     def rowCount(self, parent=QModelIndex()):
         if self._title:
-            return min(4, len(self.parent().releaseData))
+            return min(6, len(self.parent().releaseData))
         else:
             return len(self.parent().releaseData)
 
@@ -588,11 +591,12 @@ class ReleaseListModel(QAbstractListModel):
 
 class ReleaseListProxy(QSortFilterProxyModel):
     archChanged = pyqtSignal()
+    nameFilterChanged = pyqtSignal()
 
-    _archFilter = ''
+    _archFilter = ['x86_64']
     _nameFilter = ''
 
-    _archMap = {'64bit' : 'x86_64', '32bit' : 'i686'}
+    _archMap = {'64bit': ['x86_64'], '32bit': ['i686','i386']}
 
 
     def __init__(self, parent, sourceModel):
@@ -601,28 +605,40 @@ class ReleaseListProxy(QSortFilterProxyModel):
 
     def filterAcceptsRow(self, sourceRow, sourceParent):
         row = self.sourceModel().index(sourceRow, 0, sourceParent).data()
-        if len(self._archFilter) == 0 or row.arch == self._archFilter:
-            if len(self._nameFilter) == 0 or self._nameFilter in row.name:
+        if len(self._archFilter) == 0 or row.arch.lower() in [x.lower() for x in self._archFilter] or row.isLocal:
+            if len(self._nameFilter) == 0 or self._nameFilter.lower() in row.name.lower():
                 return True
         return False
 
+    @pyqtProperty(str, notify=nameFilterChanged)
+    def nameFilter(self):
+        return self._nameFilter
+
+    @nameFilter.setter
+    def nameFilter(self, value):
+        if value != self._nameFilter:
+            self._nameFilter = value
+            self.nameFilterChanged.emit()
+            self.invalidateFilter()
+
     @pyqtProperty('QStringList', constant=True)
     def possibleArchs(self):
         return self._archMap.keys()
 
     @pyqtProperty(str, notify=archChanged)
-    def currentArch(self):
-        return self._archFilter
-
-    @currentArch.setter
-    def currentArch(self, value):
-        # TODO key/value !
-        if self._archFilter != value:
-            self._archFilter = value
+    def archFilter(self):
+        for name, abbrs in self._archMap.items():
+            if abbrs == self._archFilter:
+                return name
+        self.archFilter = '64bit'
+        return '64bit'
+
+    @archFilter.setter
+    def archFilter(self, value):
+        if self._archMap.has_key(value) and self.archFilter != self._archMap[value]:
+            self._archFilter = self._archMap[value]
             self.archChanged.emit()
-
-
-
+            self.invalidateFilter()
 
 class LiveUSBLogHandler(logging.Handler):
 
@@ -664,12 +680,14 @@ class LiveUSBData(QObject):
         self._releaseModel = ReleaseListModel(self)
         self._releaseProxy = ReleaseListProxy(self, self._releaseModel)
         self._titleReleaseModel = ReleaseListModel(self, True)
-        self.releaseData = [Release(self, self.live, name='Custom OS...', shortDescription='<pick from file chooser>', fullDescription='Here you can choose a OS image from your hard drive to be written to your flash disk', isLocal=True, logo='../../data/icon-folder.svg')]
+        self._titleReleaseProxy = ReleaseListProxy(self, self._titleReleaseModel)
+        self.releaseData = [Release(self, 0, self.live, name='Custom OS...', shortDescription='<pick from file chooser>', fullDescription='Here you can choose a OS image from your hard drive to be written to your flash disk', isLocal=True, logo='../../data/icon-folder.svg')]
         for release in releases:
             self.releaseData.append(Release(self,
+                                            len(self.releaseData),
                                             self.live,
                                             name='Fedora '+release['variant'],
-                                            shortDescription='Fedora '+release['variant']+' '+release['version']+(' 64bit' if release['arch']=='x86_64' else ' 32bit'),
+                                            shortDescription='Fedora'+(' Minimal ' if release['netinst'] and not release['variant'] == 'Cloud' else ' ')+release['variant']+' '+release['version']+(' 64bit' if release['arch']=='x86_64' else ' 32bit'),
                                             arch=release['arch'],
                                             size=release['size'],
                                             url=release['url']
@@ -731,7 +749,7 @@ class LiveUSBData(QObject):
 
     @pyqtProperty(ReleaseListModel, notify=releasesChanged)
     def titleReleaseModel(self):
-        return self._titleReleaseModel
+        return self._titleReleaseProxy
 
     @pyqtProperty(int, notify=currentImageChanged)
     def currentIndex(self):
diff --git a/liveusb/releases.py b/liveusb/releases.py
index 0e12a66..dd43f94 100644
--- a/liveusb/releases.py
+++ b/liveusb/releases.py
@@ -142,15 +142,6 @@ fedora_releases = [
      'sha256': 'a6a2e83bb409d6b8ee3072ad07faac0a54d79c9ecbe3a40af91b773e2d843d8e',
      'arch': 'x86_64',
      'size': 2040109465},
-    {'url': 'http://dl.fedoraproject.org/pub/fedora/linux/releases/21/Server/x86_64/iso/Fedora-Server-netinst-x86_64-21.iso',
-     'variant': 'Server',
-     'netinst': True,
-     'live': False,
-     'version': '21',
-     'fullName': 'Fedora-Server-netinst-x86_64-21',
-     'sha256': '56af126a50c227d779a200b414f68ea7bcf58e21c8035500cd21ba164f85b9b4',
-     'arch': 'x86_64',
-     'size': 444596224},
     {'url': 'http://dl.fedoraproject.org/pub/fedora/linux/releases/21/Server/i386/iso/Fedora-Server-DVD-i386-21.iso',
      'variant': 'Server',
      'netinst': False,
@@ -160,15 +151,6 @@ fedora_releases = [
      'sha256': '85e50a8a938996522bf1605b3578a2d6680362c1aa963d0560d59c2e4fc795ef',
      'arch': 'i386',
      'size': 2147483648},
-    {'url': 'http://dl.fedoraproject.org/pub/fedora/linux/releases/21/Server/i386/iso/Fedora-Server-netinst-i386-21.iso',
-     'variant': 'Server',
-     'netinst': True,
-     'live': False,
-     'version': '21',
-     'fullName': 'Fedora-Server-netinst-i386-21',
-     'sha256': 'a39648334cbf515633f4a70b405a8fbee2662d1e7d1ad686a6861d9e1667e86c',
-     'arch': 'i386',
-     'size': 505413632},
     {'url': 'http://dl.fedoraproject.org/pub/fedora/linux/releases/21/Cloud/x86_64/iso/Fedora-Cloud-netinst-x86_64-21.iso',
      'variant': 'Cloud',
      'netinst': True,
@@ -187,6 +169,24 @@ fedora_releases = [
      'sha256': 'b3a169cb8f5b60cec0560d78f826b49384366f4a54434867d6bd90f590a6b9fc',
      'arch': 'i386',
      'size': 506462208},
+    {'url': 'http://dl.fedoraproject.org/pub/fedora/linux/releases/21/Server/x86_64/iso/Fedora-Server-netinst-x86_64-21.iso',
+     'variant': 'Server',
+     'netinst': True,
+     'live': False,
+     'version': '21',
+     'fullName': 'Fedora-Server-netinst-x86_64-21',
+     'sha256': '56af126a50c227d779a200b414f68ea7bcf58e21c8035500cd21ba164f85b9b4',
+     'arch': 'x86_64',
+     'size': 444596224},
+    {'url': 'http://dl.fedoraproject.org/pub/fedora/linux/releases/21/Server/i386/iso/Fedora-Server-netinst-i386-21.iso',
+     'variant': 'Server',
+     'netinst': True,
+     'live': False,
+     'version': '21',
+     'fullName': 'Fedora-Server-netinst-i386-21',
+     'sha256': 'a39648334cbf515633f4a70b405a8fbee2662d1e7d1ad686a6861d9e1667e86c',
+     'arch': 'i386',
+     'size': 505413632},
     {'url': 'http://dl.fedoraproject.org/pub/fedora/linux/releases/21/Live/x86_64/Fedora-Live-KDE-x86_64-21-5.iso',
      'variant': 'KDE',
      'netinst': False,

-- 
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