[Pkg-privacy-commits] [tails-installer] 104/210: Cleanup in the list model code
Intrigeri
intrigeri at moszumanska.debian.org
Wed May 24 15:26:34 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 e7473854104cfb4214725741e543297d3fd1f176
Author: Martin Briza <mbriza at redhat.com>
Date: Wed Jun 17 12:46:02 2015 +0200
Cleanup in the list model code
---
liveusb/components/ImageList.qml | 21 ++++++++++-----------
liveusb/gui.py | 36 +++++++++++++++++++++++-------------
2 files changed, 33 insertions(+), 24 deletions(-)
diff --git a/liveusb/components/ImageList.qml b/liveusb/components/ImageList.qml
index 5f5db73..81f38dd 100644
--- a/liveusb/components/ImageList.qml
+++ b/liveusb/components/ImageList.qml
@@ -7,7 +7,6 @@ Item {
id: root
property alias currentIndex: osListView.currentIndex
- property bool viewFullList: false
property real fadeDuration: 200
signal stepForward(int index)
@@ -16,8 +15,8 @@ Item {
clip: true
Rectangle {
- enabled: root.viewFullList
- opacity: root.viewFullList ? 1.0 : 0.0
+ enabled: !liveUSBData.releaseProxyModel.isFront
+ opacity: !liveUSBData.releaseProxyModel.isFront ? 1.0 : 0.0
id: searchBox
border {
color: searchInput.activeFocus ? "#4a90d9" : "#c3c3c3"
@@ -94,8 +93,8 @@ Item {
}
AdwaitaComboBox {
- enabled: root.viewFullList
- opacity: root.viewFullList ? 1.0 : 0.0
+ enabled: !liveUSBData.releaseProxyModel.isFront
+ opacity: !liveUSBData.releaseProxyModel.isFront ? 1.0 : 0.0
Behavior on opacity {
NumberAnimation {
duration: root.fadeDuration
@@ -135,7 +134,7 @@ Item {
radius: 6
color: "white"
- height: root.viewFullList ? parent.height - 54 + 4 : parent.height - 108
+ height: !liveUSBData.releaseProxyModel.isFront ? parent.height - 54 + 4 : parent.height - 108
Behavior on height {
NumberAnimation { duration: root.fadeDuration }
}
@@ -167,10 +166,10 @@ Item {
bottomMargin: -anchors.topMargin
}
footer: Item {
- height: root.viewFullList ? 54 : 36
+ height: !liveUSBData.releaseProxyModel.isFront ? 54 : 36
width: osListView.width
Rectangle {
- visible: !root.viewFullList
+ visible: liveUSBData.releaseProxyModel.isFront
anchors.fill: parent
anchors.margins: 1
radius: 3
@@ -196,7 +195,7 @@ Item {
parent.color = "transparent"
}
onClicked: {
- root.viewFullList = true
+ liveUSBData.releaseProxyModel.isFront = false
}
onPressed: {
parent.color = "#ededed"
@@ -211,7 +210,7 @@ Item {
}
}
- model: root.viewFullList ? liveUSBData.releaseProxyModel : liveUSBData.titleReleaseModel
+ model: liveUSBData.releaseProxyModel
delegate: imageDelegate
remove: Transition {
@@ -221,7 +220,7 @@ Item {
NumberAnimation { properties: "x,y"; duration: 300 }
}
add: Transition {
- NumberAnimation { properties: "x"; from: -width; duration: 300 }
+ NumberAnimation { properties: liveUSBData.releaseProxyModel.isFront ? "y" : "x"; from: liveUSBData.releaseProxyModel.isFront ? 0 : -width; duration: 300 }
}
addDisplaced: Transition {
NumberAnimation { properties: "x,y"; duration: 300 }
diff --git a/liveusb/gui.py b/liveusb/gui.py
index 4f2eab5..b8fc397 100755
--- a/liveusb/gui.py
+++ b/liveusb/gui.py
@@ -677,15 +677,11 @@ class Release(QObject):
class ReleaseListModel(QAbstractListModel):
""" An abstraction over the list of releases to have them nicely exposed to QML and ready to be filtered
"""
- def __init__(self, parent, title=False):
+ def __init__(self, parent):
QAbstractListModel.__init__(self, parent)
- self._title = title
def rowCount(self, parent=QModelIndex()):
- if self._title:
- return min(4, len(self.parent().releaseData))
- else:
- return len(self.parent().releaseData)
+ return len(self.parent().releaseData)
def roleNames(self):
return {Qt.UserRole + 1 : 'release'}
@@ -700,17 +696,24 @@ class ReleaseListProxy(QSortFilterProxyModel):
"""
archChanged = pyqtSignal()
nameFilterChanged = pyqtSignal()
+ isFrontChanged = pyqtSignal()
_archFilter = ['x86_64']
_nameFilter = ''
+ _frontPage = True
_archMap = {'64bit': ['x86_64'], '32bit': ['i686','i386']}
-
def __init__(self, parent, sourceModel):
QSortFilterProxyModel.__init__(self, parent)
self.setSourceModel(sourceModel)
+ def rowCount(self, parent=QModelIndex()):
+ print (self._frontPage, self.sourceModel().rowCount(parent))
+ if self._frontPage and self.sourceModel().rowCount(parent) > 4:
+ return 4
+ return self.sourceModel().rowCount(parent)
+
def filterAcceptsRow(self, sourceRow, sourceParent):
row = self.sourceModel().index(sourceRow, 0, sourceParent).data()
if len(self._archFilter) == 0 or row.arch.lower() in [x.lower() for x in self._archFilter] or row.isLocal:
@@ -748,6 +751,19 @@ class ReleaseListProxy(QSortFilterProxyModel):
self.archChanged.emit()
self.invalidateFilter()
+ @pyqtProperty(bool, notify=isFrontChanged)
+ def isFront(self):
+ return self._frontPage
+
+ @isFront.setter
+ def isFront(self, value):
+ if value != self._frontPage:
+ print "WOT"
+ self._frontPage = value
+ self.isFrontChanged.emit()
+ self.invalidate()
+
+
class LiveUSBLogHandler(logging.Handler):
def __init__(self, cb):
@@ -800,8 +816,6 @@ class LiveUSBData(QObject):
self.live = LiveUSBCreator(opts=opts)
self._releaseModel = ReleaseListModel(self)
self._releaseProxy = ReleaseListProxy(self, self._releaseModel)
- self._titleReleaseModel = ReleaseListModel(self, True)
- self._titleReleaseProxy = ReleaseListProxy(self, self._titleReleaseModel)
self.releaseData = []
@@ -877,10 +891,6 @@ class LiveUSBData(QObject):
def releaseProxyModel(self):
return self._releaseProxy
- @pyqtProperty(ReleaseListModel, notify=releasesChanged)
- def titleReleaseModel(self):
- return self._titleReleaseProxy
-
@pyqtProperty(int, notify=currentImageChanged)
def currentIndex(self):
return self._currentIndex
--
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