Merge remote-tracking branch 'origin/pr/154'
* origin/pr/154: Fix too long lines Moved busy_cursor() inside save_changes() Removed unneded calls to Override/Restore cursor Removed duplicated call to save_changes() Removed unneeded Cursor override/restore Added busy_cursor() Added BusyCursor for notify manager is working Revert "Added progress bar to __save_changes__" Revert "Increase progress wait time to 2s" Increase progress wait time to 2s Added progress bar to __save_changes__ Remove unneeded slot connections and reject overwrite
This commit is contained in:
commit
1d65d692ad
@ -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):
|
||||
@ -977,8 +978,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
|
||||
@ -1004,11 +1006,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):
|
||||
@ -1057,16 +1059,19 @@ 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
|
||||
@ -1086,14 +1091,17 @@ 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
|
||||
|
13
qubesmanager/settings.py
Executable file → Normal file
13
qubesmanager/settings.py
Executable file → Normal file
@ -151,10 +151,6 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog):
|
||||
assert idx in range(self.tabWidget.count())
|
||||
self.tabWidget.setCurrentIndex(idx)
|
||||
|
||||
self.buttonBox.button(QtGui.QDialogButtonBox.Ok).clicked.connect(
|
||||
self.save_and_apply)
|
||||
self.buttonBox.button(QtGui.QDialogButtonBox.Cancel).clicked.connect(
|
||||
self.reject)
|
||||
self.buttonBox.button(QtGui.QDialogButtonBox.Apply).clicked.connect(
|
||||
self.apply)
|
||||
|
||||
@ -264,15 +260,12 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog):
|
||||
return
|
||||
super(VMSettingsWindow, self).keyPressEvent(event)
|
||||
|
||||
def reject(self):
|
||||
self.done(0)
|
||||
|
||||
# needed not to close the dialog before applying changes
|
||||
def accept(self):
|
||||
pass
|
||||
self.save_and_apply()
|
||||
|
||||
def save_changes(self):
|
||||
error = self.__save_changes__()
|
||||
with common_threads.busy_cursor():
|
||||
error = self.__save_changes__()
|
||||
|
||||
if error:
|
||||
QtGui.QMessageBox.warning(
|
||||
|
Loading…
Reference in New Issue
Block a user