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