Qube manager updates more sensibly

Many events now cause the Qube Manager to refresh better - just the appropriate row, for example.
This commit is contained in:
Marta Marczykowska-Górecka 2018-02-09 21:35:06 +01:00
parent 82323ca5ed
commit dac7a6f208
No known key found for this signature in database
GPG Key ID: 9A752C30B26FD04B

View File

@ -256,7 +256,6 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow):
self.vms_list = []
self.vms_in_table = {}
self.reload_table = False
self.frame_width = 0
self.frame_height = 0
@ -395,6 +394,10 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow):
def get_vms_list(self):
return [vm for vm in self.qubes_app.domains]
def update_single_row(self, vm):
if vm in self.qubes_app.domains:
self.vms_in_table[vm.qid].update()
def fill_table(self):
# save current selection
row_index = self.table.currentRow()
@ -420,7 +423,6 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow):
self.table.setRowCount(row_no)
self.vms_list = vms_list
self.vms_in_table = vms_in_table
self.reload_table = False
if selected_qid in vms_in_table.keys():
self.table.setCurrentItem(
self.vms_in_table[selected_qid].name_widget)
@ -449,9 +451,6 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow):
def action_search_triggered(self):
self.searchbox.setFocus()
def mark_table_for_update(self):
self.reload_table = True
def update_table(self):
self.fill_table()
@ -512,6 +511,8 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow):
self.action_set_keyboard_layout.setEnabled(
vm.qid != 0 and
vm.get_power_state() != "Paused" and vm.is_running())
self.update_single_row(vm)
else:
self.action_settings.setEnabled(False)
self.action_removevm.setEnabled(False)
@ -703,7 +704,7 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow):
return
self.start_vm(vm)
self.update_table()
self.update_single_row(vm)
def start_vm(self, vm):
if vm.is_running():
@ -724,7 +725,7 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow):
self.tr("Error starting Qube!"),
self.tr("ERROR: {0}").format(t_monitor.error_msg))
self.update_table()
self.update_single_row(vm)
@staticmethod
def do_start_vm(vm, t_monitor):
@ -750,7 +751,7 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow):
assert vm.is_running()
try:
vm.pause()
self.update_table()
self.update_single_row(vm)
except exc.QubesException as ex:
QtGui.QMessageBox.warning(
None,
@ -776,7 +777,7 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow):
if reply == QtGui.QMessageBox.Yes:
self.shutdown_vm(vm)
self.update_table()
self.update_single_row(vm)
def shutdown_vm(self, vm, shutdown_time=vm_shutdown_timeout,
check_time=vm_restart_check_timeout, and_restart=False):
@ -814,7 +815,7 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow):
if reply == QtGui.QMessageBox.Yes:
self.shutdown_vm(vm, and_restart=True)
self.update_table()
self.update_single_row(vm)
# noinspection PyArgumentList
@QtCore.pyqtSlot(name='on_action_killvm_triggered')
@ -852,7 +853,7 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow):
settings_window = settings.VMSettingsWindow(
vm, self.qt_app, "basic")
settings_window.exec_()
self.update_table()
self.update_single_row(vm)
# noinspection PyArgumentList
@QtCore.pyqtSlot(name='on_action_appmenus_triggered')
@ -912,7 +913,7 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow):
self.tr("Error on Qube update!"),
self.tr("ERROR: {0}").format(t_monitor.error_msg))
self.update_table()
self.update_single_row(vm)
@staticmethod
def do_update_vm(vm, t_monitor):