[Pkg-privacy-commits] [tails-installer] 22/210: Fix display of some values
Intrigeri
intrigeri at moszumanska.debian.org
Wed May 24 15:26:24 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 cb4329f1f48d6baedb63c1e432e6050968247995
Author: Martin Briza <mbriza at redhat.com>
Date: Thu Feb 19 15:22:15 2015 +0100
Fix display of some values
---
liveusb/components/ImageDetails.qml | 25 +++++++++++++++++++++----
liveusb/gui.py | 16 ++++++++++++----
2 files changed, 33 insertions(+), 8 deletions(-)
diff --git a/liveusb/components/ImageDetails.qml b/liveusb/components/ImageDetails.qml
index 3b7ea09..61c1e21 100644
--- a/liveusb/components/ImageDetails.qml
+++ b/liveusb/components/ImageDetails.qml
@@ -2,6 +2,7 @@ import QtQuick 2.0
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2
import QtQuick.Layouts 1.1
+import QtQuick.Dialogs 1.2
Item {
id: root
@@ -44,7 +45,8 @@ Item {
color: "#729fcf"
textColor: "white"
width: implicitWidth + 16
- onClicked: dialog.visible = true
+ onClicked: dlDialog.visible = true
+ enabled: mainWindow.currentImageIndex != 0 || fileDialog.fileUrl.length > 0
anchors {
right: parent.right
top: parent.top
@@ -101,7 +103,13 @@ Item {
Text {
anchors.right: parent.right
font.pointSize: 11
- text: liveUSBData.releases[mainWindow.currentImageIndex].size > 0 ? (liveUSBData.releases[mainWindow.currentImageIndex].size + " MB") : ""
+ property double size: liveUSBData.releases[mainWindow.currentImageIndex].size
+ text: size <= 0 ? "" :
+ (size < 1024) ? (size + " B") :
+ (size < (1024 * 1024)) ? ((size / 1024).toFixed(1) + " KB") :
+ (size < (1024 * 1024 * 1024)) ? ((size / 1024 / 1024).toFixed(1) + " MB") :
+ ((size / 1024 / 1024 / 1024).toFixed(1) + " GB")
+
color: "gray"
}
}
@@ -126,7 +134,7 @@ Item {
}
Repeater {
id: screenshotRepeater
- model: ["http://fedora.cz/wp-content/uploads/2013/12/fedora-20-gnome-10.png", "http://fedora.cz/wp-content/uploads/2013/12/fedora-20-gnome-10.png"]
+ model: liveUSBData.releases[mainWindow.currentImageIndex].screenshots
IndicatedImage {
Layout.fillWidth: true
fillMode: Image.PreserveAspectFit
@@ -134,6 +142,12 @@ Item {
sourceSize.width: width
}
}
+ AdwaitaButton {
+ text: "Find the image"
+ Layout.alignment: Qt.AlignHCenter
+ visible: mainWindow.currentImageIndex == 0
+ onClicked: fileDialog.visible = true
+ }
}
}
@@ -163,7 +177,10 @@ Item {
}
}
DownloadDialog {
- id: dialog
+ id: dlDialog
+ }
+ FileDialog {
+ id: fileDialog
}
}
diff --git a/liveusb/gui.py b/liveusb/gui.py
index 89d1c56..dad0e1f 100755
--- a/liveusb/gui.py
+++ b/liveusb/gui.py
@@ -67,8 +67,9 @@ class Release(QObject):
shortDescriptionChanged = pyqtSignal()
fullDescriptionChanged = pyqtSignal()
hasDetailsChanged = pyqtSignal()
+ screenshotsChanged = pyqtSignal()
- def __init__(self, parent=None, name = '', logo = '', size = 0, arch = '', fullName = '', releaseDate = QDateTime(), shortDescription = '', fullDescription = '', hasDetails = True):
+ def __init__(self, parent=None, name = '', logo = '', size = 0, arch = '', fullName = '', releaseDate = QDateTime(), shortDescription = '', fullDescription = '', hasDetails = True, screenshots = []):
QObject.__init__(self, parent)
self._name = name
@@ -80,6 +81,7 @@ class Release(QObject):
self._shortDescription = shortDescription
self._fullDescription = fullDescription
self._hasDetails = hasDetails
+ self._screenshots = screenshots
@pyqtProperty(str, notify=nameChanged)
def name(self):
@@ -89,7 +91,7 @@ class Release(QObject):
def logo(self):
return self._logo
- @pyqtProperty(int, notify=sizeChanged)
+ @pyqtProperty(float, notify=sizeChanged)
def size(self):
return self._size
@@ -117,6 +119,10 @@ class Release(QObject):
def hasDetails(self):
return self._hasDetails
+ @pyqtProperty(QQmlListProperty, notify=screenshotsChanged)
+ def screenshots(self):
+ return QQmlListProperty(str, self, self._screenshots)
+
class LiveUSBData(QObject):
releasesChanged = pyqtSignal()
@@ -128,8 +134,10 @@ class LiveUSBData(QObject):
for release in releases:
self.releaseData.append(Release(self,
name='Fedora '+release['variant'],
- shortDescription='Fedora '+release['variant']+' '+release['version']+(' 32bit' if release['arch']=='i686' else ' 64bit'),
- arch=release['arch']))
+ shortDescription='Fedora '+release['variant']+' '+release['version']+(' 64bit' if release['arch']=='x86_64' else ' 32bit'),
+ arch=release['arch'],
+ size=release['size']
+ ))
@pyqtProperty(QQmlListProperty, notify=releasesChanged)
def releases(self):
--
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