[Pkg-privacy-commits] [tails-installer] 94/210: Improve checkbox behavior

Intrigeri intrigeri at moszumanska.debian.org
Wed May 24 15:26:32 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 be1bd0be6319c966f11fdebe784a72e405384347
Author: Martin Briza <mbriza at redhat.com>
Date:   Thu May 21 14:29:20 2015 +0200

    Improve checkbox behavior
---
 liveusb/components/DownloadDialog.qml | 10 +++++++---
 liveusb/creator.py                    |  7 +++----
 liveusb/gui.py                        | 29 ++++++++++++++++++++++++++++-
 3 files changed, 38 insertions(+), 8 deletions(-)

diff --git a/liveusb/components/DownloadDialog.qml b/liveusb/components/DownloadDialog.qml
index 6c91e03..ec65b38 100644
--- a/liveusb/components/DownloadDialog.qml
+++ b/liveusb/components/DownloadDialog.qml
@@ -378,7 +378,8 @@ Dialog {
                                     width: implicitWidth
                                     text: liveUSBData.optionNames[index]
                                     onClicked: {
-                                        acceptButton.pressedOnce = false
+                                        if (!writeImmediately.checked)
+                                            acceptButton.pressedOnce = false
                                         liveUSBData.setOption(index, checked)
                                     }
                                 }
@@ -391,8 +392,11 @@ Dialog {
                                 width: implicitWidth
                                 property bool confirmed: false
                                 text: qsTranslate("", "Write the image immediately when the download is finished")
-                                onClicked: {
-                                    acceptButton.pressedOnce = !acceptButton.pressedOnce
+                                onCheckedChanged: {
+                                    if (checked)
+                                        acceptButton.pressedOnce = false
+                                    else
+                                        acceptButton.pressedOnce = true
                                 }
                             }
                         }
diff --git a/liveusb/creator.py b/liveusb/creator.py
index 77a10e5..b204799 100755
--- a/liveusb/creator.py
+++ b/liveusb/creator.py
@@ -258,10 +258,9 @@ class LiveUSBCreator(object):
         self.log.debug('overlaysize = %d' % overlaysize)
         self.totalsize = overlaysize + self.isosize
         if self.totalsize > freebytes:
-            raise LiveUSBError(_("Not enough free space on device." +
-                                 "\n%dMB ISO + %dMB overlay > %dMB free space" %
-                                 (self.isosize/1024**2, self.overlay,
-                                  freebytes/1024**2)))
+            raise LiveUSBError(_("There is not enough free space on the selected device. Required: %s. Free: %s." %
+                                 (str(self.isosize/1024**2 + self.overlay) + "MB",
+                                  str(freebytes/1024**2) + "MB")))
 
     def create_persistent_overlay(self):
         if self.overlay:
diff --git a/liveusb/gui.py b/liveusb/gui.py
index 1f1281e..f5c4bf0 100755
--- a/liveusb/gui.py
+++ b/liveusb/gui.py
@@ -23,6 +23,14 @@
 
 """
 A cross-platform graphical interface for the LiveUSBCreator
+
+There was a move from the procedural code that was directly changing the UI itself.
+Now, we expose a set of properties representing each object we're manipulating in the back-end.
+The exposed properties are then handled independently in the UI.
+
+For example, when the image is being written, we just change the "writing" property. The UI then locks itself up based
+on this property. Basically, this means every relevant "enabled" property of the UI elements is bound to the "writing"
+property of the backend.
 """
 
 import os
@@ -63,6 +71,7 @@ MAX_FAT32 = 3999
 MAX_EXT = 2097152
 
 class ReleaseDownloadThread(QThread):
+    """ Heavy lifting in the process the iso file download """
     downloadFinished = pyqtSignal(str)
     downloadError = pyqtSignal(str)
 
@@ -88,6 +97,9 @@ class ReleaseDownloadThread(QThread):
             self.downloadFinished.emit(iso)
 
 class ReleaseDownload(QObject, BaseMeter):
+    """ Wrapper for the iso download process.
+    It exports properties to track the percentage and the file with the result.
+    """
     runningChanged = pyqtSignal()
     currentChanged = pyqtSignal()
     maximumChanged = pyqtSignal()
@@ -177,6 +189,7 @@ class ReleaseDownload(QObject, BaseMeter):
             self.pathChanged.emit()
 
 class ReleaseWriterProgressThread(QThread):
+    """ Periodically checks how the write progresses """
     alive = True
     get_free_bytes = None
     drive = None
@@ -208,7 +221,7 @@ class ReleaseWriterProgressThread(QThread):
 
 
 class ReleaseWriterThread(QThread):
-
+    """ The actual write to the portable drive """
 
     def __init__(self, parent, progressThread):
         QThread.__init__(self, parent)
@@ -219,6 +232,7 @@ class ReleaseWriterThread(QThread):
 
 
     def run(self):
+        # TODO move this to the backend
         #handler = LiveUSBLogHandler(self.parent.status)
         #self.live.log.addHandler(handler)
         now = datetime.now()
@@ -235,6 +249,7 @@ class ReleaseWriterThread(QThread):
         #self.live.log.removeHandler(handler)
 
     def ddImage(self, now):
+        # TODO move this to the backend
         self.live.dd_image()
         #self.live.log.removeHandler(handler)
         #duration = str(datetime.now() - now).split('.')[0]
@@ -244,6 +259,7 @@ class ReleaseWriterThread(QThread):
         return
 
     def copyImage(self, now):
+        # TODO move this to the backend
 
         self.parent.status = _('Checking the source image')
         self.live.check_free_space()
@@ -305,6 +321,7 @@ class ReleaseWriterThread(QThread):
         self.parent.progress = value
 
 class ReleaseWriter(QObject):
+    """ Here we can track the progress of the writing and control it """
     runningChanged = pyqtSignal()
     currentChanged = pyqtSignal()
     maximumChanged = pyqtSignal()
@@ -401,6 +418,9 @@ class ReleaseWriter(QObject):
 
 
 class Release(QObject):
+    ''' Contains the information about the particular release of Fedora
+        I think there should be a cleanup of all the properties - there seem to be more of them than needed
+    '''
     screenshotsChanged = pyqtSignal()
     errorChanged = pyqtSignal()
     warningChanged = pyqtSignal()
@@ -650,6 +670,8 @@ class Release(QObject):
             self.errorChanged.emit()
 
 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):
         QAbstractListModel.__init__(self, parent)
         self._title = title
@@ -669,6 +691,8 @@ class ReleaseListModel(QAbstractListModel):
         return None
 
 class ReleaseListProxy(QSortFilterProxyModel):
+    """ Filtering proxy for the release list
+    """
     archChanged = pyqtSignal()
     nameFilterChanged = pyqtSignal()
 
@@ -745,6 +769,9 @@ class USBDrive(QObject):
         return self._drive
 
 class LiveUSBData(QObject):
+    """ An entry point to all the exposed properties.
+        There is a list of images and USB drives
+    """
     releasesChanged = pyqtSignal()
     currentImageChanged = pyqtSignal()
     usbDrivesChanged = pyqtSignal()

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