Do not strictly depend on kdialog
Use QInputDialog where possible, fallback to zenity where not.
This commit is contained in:
parent
05de91293e
commit
73598b0344
@ -1264,14 +1264,13 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
|||||||
while self.qvm_collection.get_vm_by_name(name_format % name_number):
|
while self.qvm_collection.get_vm_by_name(name_format % name_number):
|
||||||
name_number += 1
|
name_number += 1
|
||||||
|
|
||||||
cmd = ['kdialog', '--title', 'Qubes clone VM', '--inputbox', 'Enter name for VM <b>'+vm.name+'</b> clone:', name_format % name_number]
|
(clone_name, ok) = QInputDialog.getText(self, 'Qubes clone VM',
|
||||||
kdialog = subprocess.Popen(cmd, stdout = subprocess.PIPE)
|
'Enter name for VM <b>'+vm.name+'</b> clone:', text=name_format % name_number)
|
||||||
clone_name = kdialog.stdout.read().strip()
|
if not ok or clone_name == "":
|
||||||
if clone_name == "":
|
|
||||||
return
|
return
|
||||||
|
|
||||||
thread_monitor = ThreadMonitor()
|
thread_monitor = ThreadMonitor()
|
||||||
thread = threading.Thread (target=self.do_clone_vm, args=(vm, clone_name, thread_monitor))
|
thread = threading.Thread (target=self.do_clone_vm, args=(vm, str(clone_name), thread_monitor))
|
||||||
thread.daemon = True
|
thread.daemon = True
|
||||||
thread.start()
|
thread.start()
|
||||||
|
|
||||||
@ -1496,8 +1495,12 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
|||||||
def action_run_command_in_vm_triggered(self):
|
def action_run_command_in_vm_triggered(self):
|
||||||
vm = self.get_selected_vm()
|
vm = self.get_selected_vm()
|
||||||
|
|
||||||
|
(command_to_run, ok) = QInputDialog.getText(self, 'Qubes command entry',
|
||||||
|
'Run command in <b>'+vm.name+'</b>:')
|
||||||
|
if not ok or command_to_run == "":
|
||||||
|
return
|
||||||
thread_monitor = ThreadMonitor()
|
thread_monitor = ThreadMonitor()
|
||||||
thread = threading.Thread (target=self.do_run_command_in_vm, args=(vm, thread_monitor))
|
thread = threading.Thread (target=self.do_run_command_in_vm, args=(vm, str(command_to_run), thread_monitor))
|
||||||
thread.daemon = True
|
thread.daemon = True
|
||||||
thread.start()
|
thread.start()
|
||||||
|
|
||||||
@ -1509,17 +1512,12 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
|||||||
QMessageBox.warning (None, "Error while running command", "Exception while running command:<br>{0}".format(thread_monitor.error_msg))
|
QMessageBox.warning (None, "Error while running command", "Exception while running command:<br>{0}".format(thread_monitor.error_msg))
|
||||||
|
|
||||||
|
|
||||||
def do_run_command_in_vm(self, vm, thread_monitor):
|
def do_run_command_in_vm(self, vm, command_to_run, thread_monitor):
|
||||||
cmd = ['kdialog', '--title', 'Qubes command entry', '--inputbox', 'Run command in <b>'+vm.name+'</b>:']
|
try:
|
||||||
kdialog = subprocess.Popen(cmd, stdout = subprocess.PIPE)
|
vm.run(command_to_run, verbose=False, autostart=True,
|
||||||
command_to_run = kdialog.stdout.read()
|
notify_function=lambda lvl, msg: trayIcon.showMessage(msg, msecs=3000) )
|
||||||
command_to_run = command_to_run.strip()
|
except Exception as ex:
|
||||||
if command_to_run != "":
|
thread_monitor.set_error_msg(str(ex))
|
||||||
try:
|
|
||||||
vm.run(command_to_run, verbose=False, autostart=True,
|
|
||||||
notify_function=lambda lvl, msg: trayIcon.showMessage(msg, msecs=3000) )
|
|
||||||
except Exception as ex:
|
|
||||||
thread_monitor.set_error_msg(str(ex))
|
|
||||||
thread_monitor.set_finished()
|
thread_monitor.set_finished()
|
||||||
|
|
||||||
@pyqtSlot(name='on_action_set_keyboard_layout_triggered')
|
@pyqtSlot(name='on_action_set_keyboard_layout_triggered')
|
||||||
|
@ -9,10 +9,17 @@ if [ ! -e $1 ]; then
|
|||||||
exit 1; #no such path
|
exit 1; #no such path
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if type kdialog &> /dev/null; then
|
||||||
|
PROMPT="kdialog --title Qubes --password"
|
||||||
|
else
|
||||||
|
PROMPT="zenity --entry --title Qubes --hide-text --text"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
#check if luks-encrypted
|
#check if luks-encrypted
|
||||||
if sudo cryptsetup isLuks $1 ; then
|
if sudo cryptsetup isLuks $1 ; then
|
||||||
# Is a luks device
|
# Is a luks device
|
||||||
if ! kdialog --password "Please unlock the LUKS-encrypted $1 device:" | sudo pmount $1 $2 ; then
|
if ! $PROMPT "Please unlock the LUKS-encrypted $1 device:" | sudo pmount $1 $2 ; then
|
||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
@ -11,7 +11,7 @@ Group: Qubes
|
|||||||
Vendor: Invisible Things Lab
|
Vendor: Invisible Things Lab
|
||||||
License: GPL
|
License: GPL
|
||||||
URL: http://fixme
|
URL: http://fixme
|
||||||
Requires: python, PyQt4, qubes-core-dom0 > 1.7.23, kdebase
|
Requires: python, PyQt4, qubes-core-dom0 > 1.7.23
|
||||||
Requires: pmount, cryptsetup, wmctrl
|
Requires: pmount, cryptsetup, wmctrl
|
||||||
Requires: dbus
|
Requires: dbus
|
||||||
BuildRequires: PyQt4-devel
|
BuildRequires: PyQt4-devel
|
||||||
|
Loading…
Reference in New Issue
Block a user