Fixed logs display in Qube Manager

Logs menu was not updated correctly on all occassions.
This commit is contained in:
Marta Marczykowska-Górecka 2019-04-30 16:35:54 +02:00
parent f5586e770b
commit cb70b9bd65
No known key found for this signature in database
GPG Key ID: 9A752C30B26FD04B

View File

@ -767,6 +767,8 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow):
self.action_run_command_in_vm.setEnabled(False) self.action_run_command_in_vm.setEnabled(False)
self.action_set_keyboard_layout.setEnabled(False) self.action_set_keyboard_layout.setEnabled(False)
self.update_logs_menu()
# noinspection PyArgumentList # noinspection PyArgumentList
@QtCore.pyqtSlot(name='on_action_createvm_triggered') @QtCore.pyqtSlot(name='on_action_createvm_triggered')
def action_createvm_triggered(self): # pylint: disable=no-self-use def action_createvm_triggered(self): # pylint: disable=no-self-use
@ -1233,8 +1235,7 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow):
def open_tools_context_menu(self, widget, point): def open_tools_context_menu(self, widget, point):
self.tools_context_menu.exec_(widget.mapToGlobal(point)) self.tools_context_menu.exec_(widget.mapToGlobal(point))
@QtCore.pyqtSlot('const QPoint&') def update_logs_menu(self):
def open_context_menu(self, point):
try: try:
vm = self.get_selected_vm() vm = self.get_selected_vm()
@ -1260,15 +1261,21 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow):
menu_empty = False menu_empty = False
self.logs_menu.setEnabled(not menu_empty) self.logs_menu.setEnabled(not menu_empty)
if vm.qid == 0:
self.dom0_context_menu.exec_(self.table.mapToGlobal(
point + QtCore.QPoint(10, 0)))
else:
self.context_menu.exec_(self.table.mapToGlobal(
point + QtCore.QPoint(10, 0)))
except exc.QubesPropertyAccessError: except exc.QubesPropertyAccessError:
pass pass
@QtCore.pyqtSlot('const QPoint&')
def open_context_menu(self, point):
vm = self.get_selected_vm()
if vm.qid == 0:
self.dom0_context_menu.exec_(self.table.mapToGlobal(
point + QtCore.QPoint(10, 0)))
else:
self.context_menu.exec_(self.table.mapToGlobal(
point + QtCore.QPoint(10, 0)))
@QtCore.pyqtSlot('QAction *') @QtCore.pyqtSlot('QAction *')
def show_log(self, action): def show_log(self, action):
log = str(action.data()) log = str(action.data())