[Pkg-privacy-commits] [tails-installer] 50/210: Allow option changing from the download dialog
Intrigeri
intrigeri at moszumanska.debian.org
Wed May 24 15:26:27 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 dab6a11a4385ae37b80661baff8dba56d1ae4449
Author: Martin Briza <mbriza at redhat.com>
Date: Tue Apr 7 15:51:19 2015 +0200
Allow option changing from the download dialog
---
liveusb/components/DownloadDialog.qml | 9 +++----
liveusb/gui.py | 45 ++++++++++++++++++++++++++---------
2 files changed, 39 insertions(+), 15 deletions(-)
diff --git a/liveusb/components/DownloadDialog.qml b/liveusb/components/DownloadDialog.qml
index 60a4e79..d7a2442 100644
--- a/liveusb/components/DownloadDialog.qml
+++ b/liveusb/components/DownloadDialog.qml
@@ -108,16 +108,17 @@ Dialog {
flat: true
checked: false
checkable: true
- enabled: liveUSBData.options && liveUSBData.options[0]
+ enabled: liveUSBData.optionNames && liveUSBData.optionNames[0]
ColumnLayout {
Repeater {
id: groupLayoutRepeater
- model: group.checked ? liveUSBData.options : null
+ model: group.checked ? liveUSBData.optionValues : null
CheckBox {
- checked: false
+ checked: liveUSBData.optionValues[index]
height: 20
width: 20
- text: groupLayoutRepeater.model[index]
+ text: liveUSBData.optionNames[index]
+ onCheckedChanged: liveUSBData.setOption(index, checked)
}
}
}
diff --git a/liveusb/gui.py b/liveusb/gui.py
index ae5d21d..f0cd841 100755
--- a/liveusb/gui.py
+++ b/liveusb/gui.py
@@ -206,13 +206,12 @@ class ReleaseWriterProgressThread(QThread):
class ReleaseWriterThread(QThread):
- def __init__(self, parent, progressThread, useDD = False):
+ def __init__(self, parent, progressThread):
QThread.__init__(self, parent)
self.live = parent.live
self.parent = parent
self.progressThread = progressThread
- self._useDD = useDD
def run(self):
@@ -232,7 +231,6 @@ class ReleaseWriterThread(QThread):
#self.live.log.removeHandler(handler)
def ddImage(self, now):
- self.status = _("WARNING: You are about to perform a destructive install. This will destroy all data and partitions on your USB drive. Press 'Create Live USB' again to continue.")
self.live.dd_image()
#self.live.log.removeHandler(handler)
duration = str(datetime.now() - now).split('.')[0]
@@ -316,7 +314,7 @@ class ReleaseWriter(QObject):
QObject.__init__(self, parent)
self.live = parent.live
self.progressWatcher = ReleaseWriterProgressThread(self)
- self.worker = ReleaseWriterThread(self, self.progressWatcher, False)
+ self.worker = ReleaseWriterThread(self, self.progressWatcher)
def reset(self):
self._running = False
@@ -327,7 +325,7 @@ class ReleaseWriter(QObject):
self.maximumChanged.emit()
@pyqtSlot()
- def run(self, useDD = False):
+ def run(self):
self._running = True
self._current = 0.0
self._maximum = 100.0
@@ -467,6 +465,9 @@ class Release(QObject):
@pyqtSlot()
def inspectDestination(self):
+ self.info = []
+ if self.parent().option('dd'):
+ self.addInfo(_("<font color=\"red\">!</font> You are about to perform a destructive install. This will destroy all data and partitions on your USB drive"))
if self.live.blank_mbr():
self.addInfo(_("The Master Boot Record on your device is blank. Writing the image will reset the MBR on this device"))
elif not self.live.mbr_matches_syslinux_bin():
@@ -485,7 +486,7 @@ class Release(QObject):
self.runningChanged.emit()
if self.live.existing_liveos():
- self.addInfo(_("\nYour device already contains a LiveOS. If you continue, it will be overwritten."))
+ self.addInfo(_("\n<font color=\"red\">!</font>Your device already contains a LiveOS. If you continue, it will be overwritten."))
#TODO
self.live.verify_filesystem()
@@ -702,12 +703,18 @@ class LiveUSBData(QObject):
currentImageChanged = pyqtSignal()
usbDrivesChanged = pyqtSignal()
currentDriveChanged = pyqtSignal()
+ optionsChanged = pyqtSignal()
_currentIndex = 0
_currentDrive = 0
- _options = [_("Use <b>dd</b> to write the image - this will erase everything on your portable drive"), _("Reset the MBR (Master Boot Record)")]
- _optionValues = [False, False]
+ # man, this is just awkward... but it seems like the only way to do it in a predictable manner without creating a new class
+ _optionKeys = ['dd', 'resetMBR']
+ _optionNames = {'dd': _("Use <b>dd</b> to write the image - this will erase everything on your portable drive"),
+ 'resetMBR': _("Reset the MBR (Master Boot Record)")
+ }
+ _optionValues = {'dd': False,
+ 'resetMBR': False}
def __init__(self, opts):
QObject.__init__(self)
@@ -829,12 +836,28 @@ class LiveUSBData(QObject):
r.download.finished = False
@pyqtProperty('QStringList', constant=True)
- def options(self):
- return self._options
+ def optionNames(self):
+ ret = []
+ for i in self._optionKeys:
+ ret.append(self._optionNames[i])
+ return ret
+
+ @pyqtProperty('QVariant', notify=optionsChanged)
+ def optionValues(self):
+ ret = []
+ for i in self._optionKeys:
+ ret.append(self._optionValues[i])
+ return ret
@pyqtSlot(int, bool)
def setOption(self, index, value):
- self._options[index] = value
+ if self._optionValues[self._optionKeys[index]] != value:
+ self._optionValues[self._optionKeys[index]] = value
+ self.optionsChanged.emit()
+
+ @pyqtSlot()
+ def option(self, index):
+ return self._optionValues[index]
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