[Pkg-privacy-commits] [tails-installer] 46/210: Improve the messages

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 f292734e8064e1128b2288bcb913ab4299bb669d
Author: Martin Briza <mbriza at redhat.com>
Date:   Wed Mar 25 13:37:33 2015 +0100

    Improve the messages
---
 liveusb/components/DownloadDialog.qml | 15 ++++++++++++++
 liveusb/creator.py                    |  3 ---
 liveusb/gui.py                        | 37 +++++++++++++++++++++++++++--------
 3 files changed, 44 insertions(+), 11 deletions(-)

diff --git a/liveusb/components/DownloadDialog.qml b/liveusb/components/DownloadDialog.qml
index 60b24c9..d7edaba 100644
--- a/liveusb/components/DownloadDialog.qml
+++ b/liveusb/components/DownloadDialog.qml
@@ -106,6 +106,7 @@ Dialog {
                 enabled: !liveUSBData.currentImage.writer.running
                 onClicked: {
                     liveUSBData.currentImage.download.cancel()
+                    liveUSBData.currentImage.writer.cancel()
                     root.close()
                 }
             }
@@ -124,5 +125,19 @@ Dialog {
                 onClicked: liveUSBData.currentImage.write()
             }
         }
+        Dialog {
+            id: confirmDialog
+            Item {
+                implicitWidth: 800
+                implicitHeight: 240
+                Text {
+                    text: "Your drive already contains a live operating system. Do you wish to continue?"
+                }
+                Text {
+                    text: "By continuing, the existing OS will be overwritten."
+                }
+            }
+            standardButtons: StandardButton.Yes | StandardButton.No
+        }
     }
 }
diff --git a/liveusb/creator.py b/liveusb/creator.py
index 445c896..49167b0 100755
--- a/liveusb/creator.py
+++ b/liveusb/creator.py
@@ -251,8 +251,6 @@ class LiveUSBCreator(object):
         overlaysize = self.overlay * 1024**2
         self.log.debug('overlaysize = %d' % overlaysize)
         self.totalsize = overlaysize + self.isosize
-        print(self.totalsize)
-        print(freebytes)
         if self.totalsize > freebytes:
             raise LiveUSBError(_("Not enough free space on device." +
                                  "\n%dMB ISO + %dMB overlay > %dMB free space" %
@@ -803,7 +801,6 @@ class LinuxLiveUSBCreator(LiveUSBCreator):
         if not os.path.exists(device):
             raise LiveUSBError(_('Cannot find device: %s') % device)
         stat = os.statvfs(device)
-        print(stat)
         return stat[statvfs.F_BSIZE] * stat[statvfs.F_BAVAIL]
 
     def _get_device(self, udi):
diff --git a/liveusb/gui.py b/liveusb/gui.py
index ac272a2..1b06eb3 100755
--- a/liveusb/gui.py
+++ b/liveusb/gui.py
@@ -128,6 +128,7 @@ class ReleaseDownload(QObject, BaseMeter):
 
     @pyqtSlot(str)
     def childFinished(self, iso):
+        self.reset()
         self.path = iso
         self._running = False
         self.runningChanged.emit()
@@ -190,7 +191,6 @@ class ReleaseWriterProgressThread(QThread):
             free = self.get_free_bytes()
             value = (self.orig_free - free) / 1024
             self.parent().progress = value
-            print(self.totalSize, value)
             if (value >= self.totalSize):
                 break
             sleep(3)
@@ -234,6 +234,7 @@ class ReleaseWriterThread(QThread):
         self.live.dd_image()
         #self.live.log.removeHandler(handler)
         duration = str(datetime.now() - now).split('.')[0]
+        self.progressThread.stop()
         return
 
     def copyImage(self, now):
@@ -284,13 +285,17 @@ class ReleaseWriterThread(QThread):
         self.progressThread.stop()
 
         # Flush all filesystem buffers and unmount
+        self.parent.status = "Flushing buffers"
         self.live.flush_buffers()
+        self.parent.status = "Unmounting"
         self.live.unmount_device()
+        self.parent.status = "Finished!"
+        self.parent.finished = True
 
         duration = str(datetime.now() - now).split('.')[0]
-        self.parent.status = _("Complete! (%s)" % duration)
+        #self.parent.status = "Complete! (%s)" % duration
 
-        #self.progressThread.terminate()
+        self.progressThread.stop()
 
     def set_max_progress(self, maximum):
         self.parent.maxProgress = maximum
@@ -303,11 +308,13 @@ class ReleaseWriter(QObject):
     currentChanged = pyqtSignal()
     maximumChanged = pyqtSignal()
     statusChanged = pyqtSignal()
+    finishedChanged = pyqtSignal()
 
     _running = False
     _current = -1.0
     _maximum = -1.0
     _status = ""
+    _finished = False
 
     def __init__(self, parent):
         QObject.__init__(self, parent)
@@ -368,6 +375,12 @@ class ReleaseWriter(QObject):
 
         self.worker.start()
 
+    @pyqtSlot()
+    def cancel(self):
+        self.progressWatcher.stop()
+        self.worker.terminate()
+        self.reset()
+
     @pyqtProperty(bool, notify=runningChanged)
     def running(self):
         return self._running
@@ -377,8 +390,6 @@ class ReleaseWriter(QObject):
         if self._running != value:
             self._running = value
             self.runningChanged.emit()
-        if not self._running:
-            self.status = ""
 
     @pyqtProperty(float, notify=maximumChanged)
     def maxProgress(self):
@@ -386,7 +397,6 @@ class ReleaseWriter(QObject):
 
     @maxProgress.setter
     def maxProgress(self, value):
-        print("MAXPROGRESS", value)
         if (value != self._maximum):
             self._maximum = value
             self.maximumChanged.emit()
@@ -397,7 +407,6 @@ class ReleaseWriter(QObject):
 
     @progress.setter
     def progress(self, value):
-        print("PROGRESS", value)
         if (value != self._current):
             self._current = value
             self.currentChanged.emit()
@@ -412,6 +421,16 @@ class ReleaseWriter(QObject):
             self._status = s
             self.statusChanged.emit()
 
+    @pyqtProperty(bool, notify=finishedChanged)
+    def finished(self):
+        return self._finished
+
+    @finished.setter
+    def finished(self, value):
+        if self._finished != value:
+            self._finished = value
+            self.finishedChanged.emit()
+
 
 class Release(QObject):
     screenshotsChanged = pyqtSignal()
@@ -565,7 +584,7 @@ class Release(QObject):
             return 'Starting'
         elif self._download.running:
             return 'Downloading'
-        elif self.readyToWrite and not self._writer.running:
+        elif self.readyToWrite and not self._writer.running and not self._writer.finished:
             return 'Ready to write'
         elif self._writer.status:
             return self._writer.status
@@ -792,6 +811,8 @@ class LiveUSBData(QObject):
             if len(self._usbDrives) > 0:
                 self.live.drive = self._usbDrives[self._currentDrive].drive['device']
             self.currentDriveChanged.emit()
+            for r in self.releaseData:
+                r.download.finished = False
 
 
 class LiveUSBApp(QApplication):

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