Added busy_cursor()
fix https://github.com/QubesOS/qubes-issues/issues/4744
This commit is contained in:
parent
9750d990a7
commit
8e383e3022
@ -20,10 +20,21 @@
|
||||
#
|
||||
|
||||
|
||||
from PyQt4 import QtCore # pylint: disable=import-error
|
||||
from PyQt4 import QtCore, QtGui # pylint: disable=import-error
|
||||
from contextlib import contextmanager
|
||||
|
||||
from qubesadmin import exc
|
||||
|
||||
|
||||
@contextmanager
|
||||
def busy_cursor():
|
||||
try:
|
||||
QtGui.QApplication.setOverrideCursor(QtCore.Qt.BusyCursor)
|
||||
yield
|
||||
finally:
|
||||
QtGui.QApplication.restoreOverrideCursor()
|
||||
|
||||
|
||||
# pylint: disable=too-few-public-methods
|
||||
class RemoveVMThread(QtCore.QThread):
|
||||
def __init__(self, vm):
|
||||
|
@ -741,7 +741,8 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow):
|
||||
# noinspection PyArgumentList
|
||||
@QtCore.pyqtSlot(name='on_action_createvm_triggered')
|
||||
def action_createvm_triggered(self): # pylint: disable=no-self-use
|
||||
create_window = create_new_vm.NewVmDlg(self.qt_app, self.qubes_app)
|
||||
with common_threads.busy_cursor():
|
||||
create_window = create_new_vm.NewVmDlg(self.qt_app, self.qubes_app)
|
||||
create_window.exec_()
|
||||
|
||||
def get_selected_vm(self):
|
||||
@ -976,8 +977,9 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow):
|
||||
def action_settings_triggered(self):
|
||||
vm = self.get_selected_vm()
|
||||
if vm:
|
||||
settings_window = settings.VMSettingsWindow(
|
||||
vm, self.qt_app, "basic")
|
||||
with common_threads.busy_cursor():
|
||||
settings_window = settings.VMSettingsWindow(
|
||||
vm, self.qt_app, "basic")
|
||||
settings_window.exec_()
|
||||
|
||||
vm_deleted = False
|
||||
@ -1003,11 +1005,11 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow):
|
||||
def action_appmenus_triggered(self):
|
||||
vm = self.get_selected_vm()
|
||||
if vm:
|
||||
settings_window = settings.VMSettingsWindow(
|
||||
vm, self.qt_app, "applications")
|
||||
with common_threads.busy_cursor():
|
||||
settings_window = settings.VMSettingsWindow(
|
||||
vm, self.qt_app, "applications")
|
||||
settings_window.exec_()
|
||||
|
||||
|
||||
# noinspection PyArgumentList
|
||||
@QtCore.pyqtSlot(name='on_action_updatevm_triggered')
|
||||
def action_updatevm_triggered(self):
|
||||
@ -1056,16 +1058,18 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow):
|
||||
# noinspection PyArgumentList
|
||||
@QtCore.pyqtSlot(name='on_action_editfwrules_triggered')
|
||||
def action_editfwrules_triggered(self):
|
||||
vm = self.get_selected_vm()
|
||||
settings_window = settings.VMSettingsWindow(vm, self.qt_app, "firewall")
|
||||
with common_threads.busy_cursor():
|
||||
vm = self.get_selected_vm()
|
||||
settings_window = settings.VMSettingsWindow(vm, self.qt_app, "firewall")
|
||||
settings_window.exec_()
|
||||
|
||||
# noinspection PyArgumentList
|
||||
@QtCore.pyqtSlot(name='on_action_global_settings_triggered')
|
||||
def action_global_settings_triggered(self): # pylint: disable=invalid-name
|
||||
global_settings_window = global_settings.GlobalSettingsWindow(
|
||||
self.qt_app,
|
||||
self.qubes_app)
|
||||
with common_threads.busy_cursor():
|
||||
global_settings_window = global_settings.GlobalSettingsWindow(
|
||||
self.qt_app,
|
||||
self.qubes_app)
|
||||
global_settings_window.exec_()
|
||||
|
||||
# noinspection PyArgumentList
|
||||
@ -1085,14 +1089,16 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow):
|
||||
# noinspection PyArgumentList
|
||||
@QtCore.pyqtSlot(name='on_action_restore_triggered')
|
||||
def action_restore_triggered(self):
|
||||
restore_window = restore.RestoreVMsWindow(self.qt_app, self.qubes_app)
|
||||
with common_threads.busy_cursor():
|
||||
restore_window = restore.RestoreVMsWindow(self.qt_app, self.qubes_app)
|
||||
restore_window.exec_()
|
||||
|
||||
# noinspection PyArgumentList
|
||||
@QtCore.pyqtSlot(name='on_action_backup_triggered')
|
||||
def action_backup_triggered(self):
|
||||
backup_window = backup.BackupVMsWindow(self.qt_app, self.qubes_app,
|
||||
self.dispatcher, self)
|
||||
with common_threads.busy_cursor():
|
||||
backup_window = backup.BackupVMsWindow(self.qt_app, self.qubes_app,
|
||||
self.dispatcher, self)
|
||||
backup_window.show()
|
||||
|
||||
# noinspection PyArgumentList
|
||||
|
5
qubesmanager/settings.py
Executable file → Normal file
5
qubesmanager/settings.py
Executable file → Normal file
@ -278,10 +278,13 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog):
|
||||
self.tr("ERROR: {0}").format('\n'.join(error)))
|
||||
|
||||
def apply(self):
|
||||
with common_threads.busy_cursor():
|
||||
self.save_changes()
|
||||
self.save_changes()
|
||||
|
||||
def save_and_apply(self):
|
||||
self.save_changes()
|
||||
with common_threads.busy_cursor():
|
||||
self.save_changes()
|
||||
self.done(0)
|
||||
|
||||
def __save_changes__(self):
|
||||
|
Loading…
Reference in New Issue
Block a user