[Pkg-privacy-commits] [tails-installer] 92/210: Detect USB drive changes on the fly
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 4cedfe6629b3928133230cd7b763057d09ce61a9
Author: Martin Briza <mbriza at redhat.com>
Date: Wed May 13 13:14:21 2015 +0200
Detect USB drive changes on the fly
---
liveusb/components/DownloadDialog.qml | 12 ++++++++++--
liveusb/gui.py | 13 ++++++++++---
2 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/liveusb/components/DownloadDialog.qml b/liveusb/components/DownloadDialog.qml
index faceb8a..6c91e03 100644
--- a/liveusb/components/DownloadDialog.qml
+++ b/liveusb/components/DownloadDialog.qml
@@ -209,25 +209,33 @@ Dialog {
}
}
AdwaitaComboBox {
- Layout.preferredWidth: implicitWidth * 2.4
+ Layout.preferredWidth: implicitWidth * 2.5
model: liveUSBData.usbDriveNames
currentIndex: liveUSBData.currentDrive
onCurrentIndexChanged: {
acceptButton.pressedOnce = false
liveUSBData.currentDrive = currentIndex
}
+ onModelChanged: {
+ if (liveUSBData.usbDriveNames.length <= 0)
+ currentIndex = -1
+ }
+
enabled: !liveUSBData.currentImage.writer.running
Row {
+ spacing: 8
anchors.fill: parent
+ anchors.leftMargin: 8
visible: liveUSBData.usbDriveNames.length <= 0
BusyIndicator {
anchors.verticalCenter: parent.verticalCenter
height: parent.height * 0.6
+ width: height
}
Text {
height: parent.height
verticalAlignment: Text.AlignVCenter
- text: qsTranslate("", "Waiting for a drive to be connected")
+ text: qsTranslate("", "There are no portable drives connected")
color: "gray"
}
}
diff --git a/liveusb/gui.py b/liveusb/gui.py
index 9825190..041bbdb 100755
--- a/liveusb/gui.py
+++ b/liveusb/gui.py
@@ -33,7 +33,7 @@ import urlparse
from time import sleep
from datetime import datetime
-from PyQt5.QtCore import pyqtProperty, pyqtSlot, QObject, QUrl, QDateTime, pyqtSignal, QThread, QAbstractListModel, QSortFilterProxyModel, QModelIndex, Qt, QTranslator, QLocale
+from PyQt5.QtCore import pyqtProperty, pyqtSlot, QObject, QUrl, QDateTime, pyqtSignal, QThread, QAbstractListModel, QSortFilterProxyModel, QModelIndex, Qt, QTranslator, QLocale, QTimer
from PyQt5.QtGui import QGuiApplication
from PyQt5.QtQml import qmlRegisterType, qmlRegisterUncreatableType, QQmlComponent, QQmlApplicationEngine, QQmlListProperty
from PyQt5 import QtQuick
@@ -792,6 +792,13 @@ class LiveUSBData(QObject):
self._usbDrives = []
self.currentDriveChanged.connect(self.currentImage.inspectDestination)
+ usbTimer = QTimer(self)
+ usbTimer.setInterval(5000) # check for USB drives every 5 seconds
+ usbTimer.timeout.connect(self.USBDeviceEnumerationStart)
+ usbTimer.start()
+
+ @pyqtSlot()
+ def USBDeviceEnumerationStart(self):
try:
self.live.detect_removable_drives(callback=self.USBDeviceCallback)
except LiveUSBError, e:
@@ -807,7 +814,7 @@ class LiveUSBData(QObject):
if 'vendor' in info and 'model' in info:
name = info['vendor'] + ' ' + info['model']
elif 'label' in info:
- name = info['label']
+ name = info['device'] + ' - ' + info['label']
else:
name = info['device']
@@ -835,7 +842,7 @@ class LiveUSBData(QObject):
self._usbDrives = tmpDrives
self.usbDrivesChanged.emit()
- self.currentDrive = 0
+ self.currentDrive = -1
for i, drive in enumerate(self._usbDrives):
if drive.drive['device'] == previouslySelected:
self.currentDrive = i
--
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