From ae23443608a0d427c0ee488c59e22df508e0ac12 Mon Sep 17 00:00:00 2001 From: donoban Date: Thu, 31 May 2018 00:04:46 +0200 Subject: [PATCH 01/15] Added try/except for all __lt__() methods since some VM could be deleted before the signal is received and handled. It fixes renaming a VM and deleting two domains at same time. --- qubesmanager/qube_manager.py | 8 +- qubesmanager/table_widgets.py | 172 +++++++++++++++++++++------------- 2 files changed, 112 insertions(+), 68 deletions(-) diff --git a/qubesmanager/qube_manager.py b/qubesmanager/qube_manager.py index 807311e..edde03f 100644 --- a/qubesmanager/qube_manager.py +++ b/qubesmanager/qube_manager.py @@ -961,7 +961,13 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow): settings_window = settings.VMSettingsWindow( vm, self.qt_app, "basic") settings_window.exec_() - self.vms_in_table[vm.qid].update() + + # vm could be deleted on renaming + try: + self.vms_in_table[vm.qid].update() + except exc.QubesPropertyAccessError: + pass + # noinspection PyArgumentList @QtCore.pyqtSlot(name='on_action_appmenus_triggered') diff --git a/qubesmanager/table_widgets.py b/qubesmanager/table_widgets.py index 5ccdb49..a22f909 100644 --- a/qubesmanager/table_widgets.py +++ b/qubesmanager/table_widgets.py @@ -24,6 +24,8 @@ from PyQt4 import QtGui # pylint: disable=import-error from PyQt4 import QtCore # pylint: disable=import-error # pylint: disable=too-few-public-methods +from qubesadmin import exc + power_order = QtCore.Qt.DescendingOrder update_order = QtCore.Qt.AscendingOrder @@ -74,13 +76,16 @@ class VmTypeWidget(VmIconWidget): self.value = value def __lt__(self, other): - if self.vm.qid == 0: - return True - elif other.vm.qid == 0: + try: + if self.vm.qid == 0: + return True + elif other.vm.qid == 0: + return False + elif self.value == other.value: + return self.vm.name < other.vm.name + return self.value < other.value + except exc.QubesPropertyAccessError: return False - elif self.value == other.value: - return self.vm.name < other.vm.name - return self.value < other.value def __init__(self, vm, parent=None): (icon_path, tooltip) = self.get_vm_icon(vm) @@ -120,13 +125,16 @@ class VmLabelWidget(VmIconWidget): self.value = value def __lt__(self, other): - if self.vm.qid == 0: - return True - elif other.vm.qid == 0: + try: + if self.vm.qid == 0: + return True + elif other.vm.qid == 0: + return False + elif self.value == other.value: + return self.vm.name < other.vm.name + return self.value < other.value + except exc.QubesPropertyAccessError: return False - elif self.value == other.value: - return self.vm.name < other.vm.name - return self.value < other.value def __init__(self, vm, parent=None): icon_path = self.get_vm_icon_path(vm) @@ -149,11 +157,14 @@ class VmNameItem(QtGui.QTableWidgetItem): self.qid = vm.qid def __lt__(self, other): - if self.qid == 0: - return True - elif other.qid == 0: + try: + if self.qid == 0: + return True + elif other.qid == 0: + return False + return super(VmNameItem, self).__lt__(other) + except exc.QubesPropertyAccessError: return False - return super(VmNameItem, self).__lt__(other) class VmStatusIcon(QtGui.QLabel): @@ -193,9 +204,12 @@ class VmInfoWidget(QtGui.QWidget): def __lt__(self, other): # pylint: disable=too-many-return-statements - if self.vm.qid == 0: - return True - elif other.vm.qid == 0: + try: + if self.vm.qid == 0: + return True + elif other.vm.qid == 0: + return False + except exc.QubesPropertyAccessError: return False self_val = self.upd_info_item.value @@ -278,13 +292,16 @@ class VmTemplateItem(QtGui.QTableWidgetItem): self.setText(self.vm.klass) def __lt__(self, other): - if self.vm.qid == 0: - return True - elif other.vm.qid == 0: + try: + if self.vm.qid == 0: + return True + elif other.vm.qid == 0: + return False + elif self.text() == other.text(): + return self.vm.name < other.vm.name + return super(VmTemplateItem, self).__lt__(other) + except exc.QubesPropertyAccessError: return False - elif self.text() == other.text(): - return self.vm.name < other.vm.name - return super(VmTemplateItem, self).__lt__(other) class VmNetvmItem(QtGui.QTableWidgetItem): @@ -302,13 +319,16 @@ class VmNetvmItem(QtGui.QTableWidgetItem): self.setText(self.vm.netvm.name) def __lt__(self, other): - if self.vm.qid == 0: - return True - elif other.vm.qid == 0: + try: + if self.vm.qid == 0: + return True + elif other.vm.qid == 0: + return False + elif self.text() == other.text(): + return self.vm.name < other.vm.name + return super(VmNetvmItem, self).__lt__(other) + except exc.QubesPropertyAccessError: return False - elif self.text() == other.text(): - return self.vm.name < other.vm.name - return super(VmNetvmItem, self).__lt__(other) class VmInternalItem(QtGui.QTableWidgetItem): @@ -325,11 +345,14 @@ class VmInternalItem(QtGui.QTableWidgetItem): def __lt__(self, other): - if self.vm.qid == 0: - return True - elif other.vm.qid == 0: + try: + if self.vm.qid == 0: + return True + elif other.vm.qid == 0: + return False + return super(VmInternalItem, self).__lt__(other) + except exc.QubesPropertyAccessError: return False - return super(VmInternalItem, self).__lt__(other) # features man qvm-features @@ -350,13 +373,16 @@ class VmUpdateInfoWidget(QtGui.QWidget): self.value = 0 def __lt__(self, other): - if self.vm.qid == 0: - return True - elif other.vm.qid == 0: + try: + if self.vm.qid == 0: + return True + elif other.vm.qid == 0: + return False + elif self.value == other.value: + return self.vm.name < other.vm.name + return self.value < other.value + except exc.QubesPropertyAccessError: return False - elif self.value == other.value: - return self.vm.name < other.vm.name - return self.value < other.value def __init__(self, vm, show_text=True, parent=None): super(VmUpdateInfoWidget, self).__init__(parent) @@ -457,13 +483,16 @@ class VmSizeOnDiskItem(QtGui.QTableWidgetItem): self.setText(str(self.value) + " MiB") def __lt__(self, other): - if self.vm.qid == 0: - return True - elif other.vm.qid == 0: + try: + if self.vm.qid == 0: + return True + elif other.vm.qid == 0: + return False + elif self.value == other.value: + return self.vm.name < other.vm.name + return self.value < other.value + except exc.QubesPropertyAccessError: return False - elif self.value == other.value: - return self.vm.name < other.vm.name - return self.value < other.value class VmIPItem(QtGui.QTableWidgetItem): @@ -479,11 +508,14 @@ class VmIPItem(QtGui.QTableWidgetItem): self.setText(self.ip if self.ip is not None else 'n/a') def __lt__(self, other): - if self.vm.qid == 0: - return True - elif other.vm.qid == 0: + try: + if self.vm.qid == 0: + return True + elif other.vm.qid == 0: + return False + return super(VmIPItem, self).__lt__(other) + except exc.QubesPropertyAccessError: return False - return super(VmIPItem, self).__lt__(other) class VmIncludeInBackupsItem(QtGui.QTableWidgetItem): @@ -501,13 +533,16 @@ class VmIncludeInBackupsItem(QtGui.QTableWidgetItem): self.setText("") def __lt__(self, other): - if self.vm.qid == 0: - return True - elif other.vm.qid == 0: + try: + if self.vm.qid == 0: + return True + elif other.vm.qid == 0: + return False + elif self.vm.include_in_backups == other.vm.include_in_backups: + return self.vm.name < other.vm.name + return self.vm.include_in_backups < other.vm.include_in_backups + except exc.QubesPropertyAccessError: return False - elif self.vm.include_in_backups == other.vm.include_in_backups: - return self.vm.name < other.vm.name - return self.vm.include_in_backups < other.vm.include_in_backups class VmLastBackupItem(QtGui.QTableWidgetItem): @@ -528,14 +563,17 @@ class VmLastBackupItem(QtGui.QTableWidgetItem): self.setText("") def __lt__(self, other): - if self.vm.qid == 0: - return True - elif other.vm.qid == 0: + try: + if self.vm.qid == 0: + return True + elif other.vm.qid == 0: + return False + elif self.backup_timestamp == other.backup_timestamp: + return self.vm.name < other.vm.name + elif not self.backup_timestamp: + return False + elif not other.backup_timestamp: + return True + return self.backup_timestamp < other.backup_timestamp + except exc.QubesPropertyAccessError: return False - elif self.backup_timestamp == other.backup_timestamp: - return self.vm.name < other.vm.name - elif not self.backup_timestamp: - return False - elif not other.backup_timestamp: - return True - return self.backup_timestamp < other.backup_timestamp From ac92bb5fdfa55db894c84e0f04967b28ff719af5 Mon Sep 17 00:00:00 2001 From: donoban Date: Thu, 31 May 2018 00:09:34 +0200 Subject: [PATCH 02/15] Since __lt__ methods are safe, is not needed to stop and reenable sorting. It causes a short freeze of the main window when reenabling, so better removing it. --- qubesmanager/qube_manager.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/qubesmanager/qube_manager.py b/qubesmanager/qube_manager.py index edde03f..642d567 100644 --- a/qubesmanager/qube_manager.py +++ b/qubesmanager/qube_manager.py @@ -403,8 +403,6 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow): self.qubes_app.domains.clear_cache() qid = int(domain.split('/')[-1]) - self.table.setSortingEnabled(False) - row_no = self.table.rowCount() self.table.setRowCount(row_no + 1) @@ -413,7 +411,6 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow): if vm.qid == qid: vm_row = VmRowInTable(vm, row_no, self.table) self.vms_in_table[vm.qid] = vm_row - self.table.setSortingEnabled(True) return # Never should reach here From 47e83f2039ba0bb83695a405d58da5b3fa906625 Mon Sep 17 00:00:00 2001 From: donoban Date: Thu, 31 May 2018 00:11:30 +0200 Subject: [PATCH 03/15] Added standalone VM's to check_updates() Also added an initial call when creating the timer, most users will look for updates inmediately after start the manager --- qubesmanager/qube_manager.py | 3 ++- qubesmanager/table_widgets.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/qubesmanager/qube_manager.py b/qubesmanager/qube_manager.py index 642d567..92f9cf6 100644 --- a/qubesmanager/qube_manager.py +++ b/qubesmanager/qube_manager.py @@ -392,10 +392,11 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow): timer = QtCore.QTimer(self) timer.timeout.connect(self.check_updates) timer.start(1000 * 30) # 30s + self.check_updates() def check_updates(self): for vm in self.qubes_app.domains: - if vm.klass == 'TemplateVM': + if vm.klass in {'TemplateVM', 'StandaloneVM'}: self.vms_in_table[vm.qid].update() def on_domain_added(self, _, domain): diff --git a/qubesmanager/table_widgets.py b/qubesmanager/table_widgets.py index a22f909..9bda3b1 100644 --- a/qubesmanager/table_widgets.py +++ b/qubesmanager/table_widgets.py @@ -417,7 +417,7 @@ class VmUpdateInfoWidget(QtGui.QWidget): outdated_state = "outdated" break - elif self.vm.klass == 'TemplateVM' and \ + elif self.vm.klass in {'TemplateVM', 'StandaloneVM'} and \ self.vm.features.get('updates-available', False): outdated_state = 'update' From 4d103562bde6981b1e44e1225dd7ed89429cb7d9 Mon Sep 17 00:00:00 2001 From: donoban Date: Thu, 31 May 2018 00:27:37 +0200 Subject: [PATCH 04/15] Revert "Since __lt__ methods are safe, is not needed to stop and reenable sorting." This reverts commit ac92bb5fdfa55db894c84e0f04967b28ff719af5. --- qubesmanager/qube_manager.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/qubesmanager/qube_manager.py b/qubesmanager/qube_manager.py index 92f9cf6..b12823e 100644 --- a/qubesmanager/qube_manager.py +++ b/qubesmanager/qube_manager.py @@ -404,6 +404,8 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow): self.qubes_app.domains.clear_cache() qid = int(domain.split('/')[-1]) + self.table.setSortingEnabled(False) + row_no = self.table.rowCount() self.table.setRowCount(row_no + 1) @@ -412,6 +414,7 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow): if vm.qid == qid: vm_row = VmRowInTable(vm, row_no, self.table) self.vms_in_table[vm.qid] = vm_row + self.table.setSortingEnabled(True) return # Never should reach here From cb5bc16948c1fec5db725fba3dac8bd4c2b2966a Mon Sep 17 00:00:00 2001 From: donoban Date: Thu, 31 May 2018 00:39:34 +0200 Subject: [PATCH 05/15] Don't close the settings window if something failed when renaming e.g. the VM name already exists --- qubesmanager/settings.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/qubesmanager/settings.py b/qubesmanager/settings.py index a0bbbe8..91f7f41 100755 --- a/qubesmanager/settings.py +++ b/qubesmanager/settings.py @@ -478,6 +478,8 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog): self.tr("Error!"), self.tr("ERROR: {}").format( t_monitor.error_msg)) + return False + return True def _rename_vm(self, t_monitor, name): try: @@ -492,15 +494,14 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog): t_monitor.set_finished() def rename_vm(self): - new_vm_name, ok = QtGui.QInputDialog.getText( self, self.tr('Rename qube'), self.tr('New name: (WARNING: all other changes will be discarded)')) if ok: - self._run_in_thread(self._rename_vm, new_vm_name) - self.done(0) + if self._run_in_thread(self._rename_vm, new_vm_name): + self.done(0) def _remove_vm(self, t_monitor): try: From b8cb0f625b3b42ed7c97c49d80211e0c14339ad1 Mon Sep 17 00:00:00 2001 From: donoban Date: Thu, 31 May 2018 00:47:38 +0200 Subject: [PATCH 06/15] Fix very unlikely case when user right clicks the VM in the exact moment he deletes it. --- qubesmanager/qube_manager.py | 45 +++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/qubesmanager/qube_manager.py b/qubesmanager/qube_manager.py index b12823e..22c74d6 100644 --- a/qubesmanager/qube_manager.py +++ b/qubesmanager/qube_manager.py @@ -1219,31 +1219,34 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow): @QtCore.pyqtSlot('const QPoint&') def open_context_menu(self, point): - vm = self.get_selected_vm() + try: + vm = self.get_selected_vm() - # logs menu - self.logs_menu.clear() + # logs menu + self.logs_menu.clear() - if vm.qid == 0: - logfiles = ["/var/log/xen/console/hypervisor.log"] - else: - logfiles = [ - "/var/log/xen/console/guest-" + vm.name + ".log", - "/var/log/xen/console/guest-" + vm.name + "-dm.log", - "/var/log/qubes/guid." + vm.name + ".log", - "/var/log/qubes/qrexec." + vm.name + ".log", - ] + if vm.qid == 0: + logfiles = ["/var/log/xen/console/hypervisor.log"] + else: + logfiles = [ + "/var/log/xen/console/guest-" + vm.name + ".log", + "/var/log/xen/console/guest-" + vm.name + "-dm.log", + "/var/log/qubes/guid." + vm.name + ".log", + "/var/log/qubes/qrexec." + vm.name + ".log", + ] - menu_empty = True - for logfile in logfiles: - if os.path.exists(logfile): - action = self.logs_menu.addAction(QtGui.QIcon(":/log.png"), - logfile) - action.setData(logfile) - menu_empty = False + menu_empty = True + for logfile in logfiles: + if os.path.exists(logfile): + action = self.logs_menu.addAction(QtGui.QIcon(":/log.png"), + logfile) + action.setData(logfile) + menu_empty = False - self.logs_menu.setEnabled(not menu_empty) - self.context_menu.exec_(self.table.mapToGlobal(point)) + self.logs_menu.setEnabled(not menu_empty) + self.context_menu.exec_(self.table.mapToGlobal(point)) + except exc.QubesPropertyAccessError: + pass @QtCore.pyqtSlot('QAction *') def show_log(self, action): From 2a437bcfc46bf85a19da1b7d99341e79224f8a3a Mon Sep 17 00:00:00 2001 From: donoban Date: Mon, 11 Jun 2018 01:56:10 +0200 Subject: [PATCH 07/15] Fix pylint warnings --- qubesmanager/table_widgets.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/qubesmanager/table_widgets.py b/qubesmanager/table_widgets.py index 9bda3b1..83581e3 100644 --- a/qubesmanager/table_widgets.py +++ b/qubesmanager/table_widgets.py @@ -75,6 +75,7 @@ class VmTypeWidget(VmIconWidget): def set_value(self, value): self.value = value + #pylint: disable=too-many-return-statements def __lt__(self, other): try: if self.vm.qid == 0: @@ -124,6 +125,7 @@ class VmLabelWidget(VmIconWidget): def set_value(self, value): self.value = value + #pylint: disable=too-many-return-statements def __lt__(self, other): try: if self.vm.qid == 0: @@ -156,6 +158,7 @@ class VmNameItem(QtGui.QTableWidgetItem): self.setTextAlignment(QtCore.Qt.AlignVCenter) self.qid = vm.qid + #pylint: disable=too-many-return-statements def __lt__(self, other): try: if self.qid == 0: @@ -562,6 +565,7 @@ class VmLastBackupItem(QtGui.QTableWidgetItem): else: self.setText("") + #pylint: disable=too-many-return-statements def __lt__(self, other): try: if self.vm.qid == 0: From 0c4047ffdef22d1afd097829cd8d0bf61f3b6a3a Mon Sep 17 00:00:00 2001 From: donoban Date: Mon, 11 Jun 2018 02:26:02 +0200 Subject: [PATCH 08/15] Disable no-name-in-module Maybe travis works this way --- qubesmanager/qube_manager.py | 2 +- qubesmanager/table_widgets.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/qubesmanager/qube_manager.py b/qubesmanager/qube_manager.py index 22c74d6..6ed2013 100644 --- a/qubesmanager/qube_manager.py +++ b/qubesmanager/qube_manager.py @@ -34,7 +34,7 @@ import threading from pydbus import SessionBus from qubesadmin import Qubes -from qubesadmin import exc +from qubesadmin import exc # pylint: disable=no-name-in-module from PyQt4 import QtGui # pylint: disable=import-error from PyQt4 import QtCore # pylint: disable=import-error diff --git a/qubesmanager/table_widgets.py b/qubesmanager/table_widgets.py index 83581e3..d44f0d9 100644 --- a/qubesmanager/table_widgets.py +++ b/qubesmanager/table_widgets.py @@ -24,7 +24,7 @@ from PyQt4 import QtGui # pylint: disable=import-error from PyQt4 import QtCore # pylint: disable=import-error # pylint: disable=too-few-public-methods -from qubesadmin import exc +from qubesadmin import exc # pylint: disable=no-name-in-module power_order = QtCore.Qt.DescendingOrder update_order = QtCore.Qt.AscendingOrder From 643147f5259f51820506d11513c00d2edf39be9d Mon Sep 17 00:00:00 2001 From: donoban Date: Mon, 11 Jun 2018 02:46:31 +0200 Subject: [PATCH 09/15] Another try for travis --- qubesmanager/qube_manager.py | 6 +++--- qubesmanager/table_widgets.py | 26 +++++++++++++------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/qubesmanager/qube_manager.py b/qubesmanager/qube_manager.py index 6ed2013..c6cdf19 100644 --- a/qubesmanager/qube_manager.py +++ b/qubesmanager/qube_manager.py @@ -34,7 +34,7 @@ import threading from pydbus import SessionBus from qubesadmin import Qubes -from qubesadmin import exc # pylint: disable=no-name-in-module +from qubesadmin import exc from PyQt4 import QtGui # pylint: disable=import-error from PyQt4 import QtCore # pylint: disable=import-error @@ -966,7 +966,7 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow): # vm could be deleted on renaming try: self.vms_in_table[vm.qid].update() - except exc.QubesPropertyAccessError: + except exc.QubesPropertyAccessError: # pylint: disable=no-name-in-module pass @@ -1245,7 +1245,7 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow): self.logs_menu.setEnabled(not menu_empty) self.context_menu.exec_(self.table.mapToGlobal(point)) - except exc.QubesPropertyAccessError: + except exc.QubesPropertyAccessError: # pylint: disable=no-name-in-module pass @QtCore.pyqtSlot('QAction *') diff --git a/qubesmanager/table_widgets.py b/qubesmanager/table_widgets.py index d44f0d9..5d62e7d 100644 --- a/qubesmanager/table_widgets.py +++ b/qubesmanager/table_widgets.py @@ -24,7 +24,7 @@ from PyQt4 import QtGui # pylint: disable=import-error from PyQt4 import QtCore # pylint: disable=import-error # pylint: disable=too-few-public-methods -from qubesadmin import exc # pylint: disable=no-name-in-module +from qubesadmin import exc power_order = QtCore.Qt.DescendingOrder update_order = QtCore.Qt.AscendingOrder @@ -85,7 +85,7 @@ class VmTypeWidget(VmIconWidget): elif self.value == other.value: return self.vm.name < other.vm.name return self.value < other.value - except exc.QubesPropertyAccessError: + except exc.QubesPropertyAccessError: # pylint: disable=no-name-in-module return False def __init__(self, vm, parent=None): @@ -135,7 +135,7 @@ class VmLabelWidget(VmIconWidget): elif self.value == other.value: return self.vm.name < other.vm.name return self.value < other.value - except exc.QubesPropertyAccessError: + except exc.QubesPropertyAccessError: # pylint: disable=no-name-in-module return False def __init__(self, vm, parent=None): @@ -166,7 +166,7 @@ class VmNameItem(QtGui.QTableWidgetItem): elif other.qid == 0: return False return super(VmNameItem, self).__lt__(other) - except exc.QubesPropertyAccessError: + except exc.QubesPropertyAccessError: # pylint: disable=no-name-in-module return False @@ -212,7 +212,7 @@ class VmInfoWidget(QtGui.QWidget): return True elif other.vm.qid == 0: return False - except exc.QubesPropertyAccessError: + except exc.QubesPropertyAccessError: # pylint: disable=no-name-in-module return False self_val = self.upd_info_item.value @@ -303,7 +303,7 @@ class VmTemplateItem(QtGui.QTableWidgetItem): elif self.text() == other.text(): return self.vm.name < other.vm.name return super(VmTemplateItem, self).__lt__(other) - except exc.QubesPropertyAccessError: + except exc.QubesPropertyAccessError: # pylint: disable=no-name-in-module return False @@ -330,7 +330,7 @@ class VmNetvmItem(QtGui.QTableWidgetItem): elif self.text() == other.text(): return self.vm.name < other.vm.name return super(VmNetvmItem, self).__lt__(other) - except exc.QubesPropertyAccessError: + except exc.QubesPropertyAccessError: # pylint: disable=no-name-in-module return False @@ -354,7 +354,7 @@ class VmInternalItem(QtGui.QTableWidgetItem): elif other.vm.qid == 0: return False return super(VmInternalItem, self).__lt__(other) - except exc.QubesPropertyAccessError: + except exc.QubesPropertyAccessError: # pylint: disable=no-name-in-module return False @@ -384,7 +384,7 @@ class VmUpdateInfoWidget(QtGui.QWidget): elif self.value == other.value: return self.vm.name < other.vm.name return self.value < other.value - except exc.QubesPropertyAccessError: + except exc.QubesPropertyAccessError: # pylint: disable=no-name-in-module return False def __init__(self, vm, show_text=True, parent=None): @@ -494,7 +494,7 @@ class VmSizeOnDiskItem(QtGui.QTableWidgetItem): elif self.value == other.value: return self.vm.name < other.vm.name return self.value < other.value - except exc.QubesPropertyAccessError: + except exc.QubesPropertyAccessError: # pylint: disable=no-name-in-module return False @@ -517,7 +517,7 @@ class VmIPItem(QtGui.QTableWidgetItem): elif other.vm.qid == 0: return False return super(VmIPItem, self).__lt__(other) - except exc.QubesPropertyAccessError: + except exc.QubesPropertyAccessError: # pylint: disable=no-name-in-module return False @@ -544,7 +544,7 @@ class VmIncludeInBackupsItem(QtGui.QTableWidgetItem): elif self.vm.include_in_backups == other.vm.include_in_backups: return self.vm.name < other.vm.name return self.vm.include_in_backups < other.vm.include_in_backups - except exc.QubesPropertyAccessError: + except exc.QubesPropertyAccessError: # pylint: disable=no-name-in-module return False @@ -579,5 +579,5 @@ class VmLastBackupItem(QtGui.QTableWidgetItem): elif not other.backup_timestamp: return True return self.backup_timestamp < other.backup_timestamp - except exc.QubesPropertyAccessError: + except exc.QubesPropertyAccessError: # pylint: disable=no-name-in-module return False From b8d1cc42059d082f65c7284ede4e5460e3d714e0 Mon Sep 17 00:00:00 2001 From: donoban Date: Mon, 11 Jun 2018 03:06:35 +0200 Subject: [PATCH 10/15] Try with disable=no-member --- qubesmanager/qube_manager.py | 4 ++-- qubesmanager/table_widgets.py | 22 +++++++++++----------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/qubesmanager/qube_manager.py b/qubesmanager/qube_manager.py index c6cdf19..9be6351 100644 --- a/qubesmanager/qube_manager.py +++ b/qubesmanager/qube_manager.py @@ -966,7 +966,7 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow): # vm could be deleted on renaming try: self.vms_in_table[vm.qid].update() - except exc.QubesPropertyAccessError: # pylint: disable=no-name-in-module + except exc.QubesPropertyAccessError: # pylint: disable=no-member pass @@ -1245,7 +1245,7 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow): self.logs_menu.setEnabled(not menu_empty) self.context_menu.exec_(self.table.mapToGlobal(point)) - except exc.QubesPropertyAccessError: # pylint: disable=no-name-in-module + except exc.QubesPropertyAccessError: # pylint: disable=no-member pass @QtCore.pyqtSlot('QAction *') diff --git a/qubesmanager/table_widgets.py b/qubesmanager/table_widgets.py index 5d62e7d..8054338 100644 --- a/qubesmanager/table_widgets.py +++ b/qubesmanager/table_widgets.py @@ -85,7 +85,7 @@ class VmTypeWidget(VmIconWidget): elif self.value == other.value: return self.vm.name < other.vm.name return self.value < other.value - except exc.QubesPropertyAccessError: # pylint: disable=no-name-in-module + except exc.QubesPropertyAccessError: # pylint: disable=no-member return False def __init__(self, vm, parent=None): @@ -135,7 +135,7 @@ class VmLabelWidget(VmIconWidget): elif self.value == other.value: return self.vm.name < other.vm.name return self.value < other.value - except exc.QubesPropertyAccessError: # pylint: disable=no-name-in-module + except exc.QubesPropertyAccessError: # pylint: disable=no-member return False def __init__(self, vm, parent=None): @@ -166,7 +166,7 @@ class VmNameItem(QtGui.QTableWidgetItem): elif other.qid == 0: return False return super(VmNameItem, self).__lt__(other) - except exc.QubesPropertyAccessError: # pylint: disable=no-name-in-module + except exc.QubesPropertyAccessError: # pylint: disable=no-member return False @@ -212,7 +212,7 @@ class VmInfoWidget(QtGui.QWidget): return True elif other.vm.qid == 0: return False - except exc.QubesPropertyAccessError: # pylint: disable=no-name-in-module + except exc.QubesPropertyAccessError: # pylint: disable=no-member return False self_val = self.upd_info_item.value @@ -303,7 +303,7 @@ class VmTemplateItem(QtGui.QTableWidgetItem): elif self.text() == other.text(): return self.vm.name < other.vm.name return super(VmTemplateItem, self).__lt__(other) - except exc.QubesPropertyAccessError: # pylint: disable=no-name-in-module + except exc.QubesPropertyAccessError: # pylint: disable=no-member return False @@ -330,7 +330,7 @@ class VmNetvmItem(QtGui.QTableWidgetItem): elif self.text() == other.text(): return self.vm.name < other.vm.name return super(VmNetvmItem, self).__lt__(other) - except exc.QubesPropertyAccessError: # pylint: disable=no-name-in-module + except exc.QubesPropertyAccessError: # pylint: disable=no-member return False @@ -354,7 +354,7 @@ class VmInternalItem(QtGui.QTableWidgetItem): elif other.vm.qid == 0: return False return super(VmInternalItem, self).__lt__(other) - except exc.QubesPropertyAccessError: # pylint: disable=no-name-in-module + except exc.QubesPropertyAccessError: # pylint: disable=no-member return False @@ -384,7 +384,7 @@ class VmUpdateInfoWidget(QtGui.QWidget): elif self.value == other.value: return self.vm.name < other.vm.name return self.value < other.value - except exc.QubesPropertyAccessError: # pylint: disable=no-name-in-module + except exc.QubesPropertyAccessError: # pylint: disable=no-member return False def __init__(self, vm, show_text=True, parent=None): @@ -494,7 +494,7 @@ class VmSizeOnDiskItem(QtGui.QTableWidgetItem): elif self.value == other.value: return self.vm.name < other.vm.name return self.value < other.value - except exc.QubesPropertyAccessError: # pylint: disable=no-name-in-module + except exc.QubesPropertyAccessError: # pylint: disable=no-member return False @@ -517,7 +517,7 @@ class VmIPItem(QtGui.QTableWidgetItem): elif other.vm.qid == 0: return False return super(VmIPItem, self).__lt__(other) - except exc.QubesPropertyAccessError: # pylint: disable=no-name-in-module + except exc.QubesPropertyAccessError: # pylint: disable=no-member return False @@ -544,7 +544,7 @@ class VmIncludeInBackupsItem(QtGui.QTableWidgetItem): elif self.vm.include_in_backups == other.vm.include_in_backups: return self.vm.name < other.vm.name return self.vm.include_in_backups < other.vm.include_in_backups - except exc.QubesPropertyAccessError: # pylint: disable=no-name-in-module + except exc.QubesPropertyAccessError: # pylint: disable=no-member return False From 9101f35245971b841faa765456e24143575e30ba Mon Sep 17 00:00:00 2001 From: donoban Date: Mon, 11 Jun 2018 03:18:11 +0200 Subject: [PATCH 11/15] Last no-member --- qubesmanager/table_widgets.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qubesmanager/table_widgets.py b/qubesmanager/table_widgets.py index 8054338..31489ba 100644 --- a/qubesmanager/table_widgets.py +++ b/qubesmanager/table_widgets.py @@ -579,5 +579,5 @@ class VmLastBackupItem(QtGui.QTableWidgetItem): elif not other.backup_timestamp: return True return self.backup_timestamp < other.backup_timestamp - except exc.QubesPropertyAccessError: # pylint: disable=no-name-in-module + except exc.QubesPropertyAccessError: # pylint: disable=no-member return False From 52c38b67c694aed7389ad16921856f2650180efe Mon Sep 17 00:00:00 2001 From: donoban Date: Mon, 11 Jun 2018 21:20:18 +0200 Subject: [PATCH 12/15] Fix search coherence when adding a domain A new domain was not properly filtered with the current search string --- qubesmanager/qube_manager.py | 1 + 1 file changed, 1 insertion(+) diff --git a/qubesmanager/qube_manager.py b/qubesmanager/qube_manager.py index 9be6351..8d4fa9c 100644 --- a/qubesmanager/qube_manager.py +++ b/qubesmanager/qube_manager.py @@ -415,6 +415,7 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow): vm_row = VmRowInTable(vm, row_no, self.table) self.vms_in_table[vm.qid] = vm_row self.table.setSortingEnabled(True) + self.showhide_vms() return # Never should reach here From 34bcabd79aef68e7c08716a6b7fa970a51f2730c Mon Sep 17 00:00:00 2001 From: donoban Date: Tue, 12 Jun 2018 11:42:07 +0200 Subject: [PATCH 13/15] Show updates pending while running domain Maybe it is not useful for templates but I think it is better for StandaloneVMs since you will not notice pending updates until shutdown them with the other version. --- qubesmanager/table_widgets.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qubesmanager/table_widgets.py b/qubesmanager/table_widgets.py index 31489ba..bdacd7e 100644 --- a/qubesmanager/table_widgets.py +++ b/qubesmanager/table_widgets.py @@ -420,7 +420,7 @@ class VmUpdateInfoWidget(QtGui.QWidget): outdated_state = "outdated" break - elif self.vm.klass in {'TemplateVM', 'StandaloneVM'} and \ + if self.vm.klass in {'TemplateVM', 'StandaloneVM'} and \ self.vm.features.get('updates-available', False): outdated_state = 'update' From 877eeaac2a6ec906bf99997687934d99acc4c33b Mon Sep 17 00:00:00 2001 From: donoban Date: Wed, 13 Jun 2018 21:38:39 +0200 Subject: [PATCH 14/15] Added BaseException --- qubesmanager/qube_manager.py | 4 ++-- qubesmanager/table_widgets.py | 24 ++++++++++++------------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/qubesmanager/qube_manager.py b/qubesmanager/qube_manager.py index 8d4fa9c..4bcd672 100644 --- a/qubesmanager/qube_manager.py +++ b/qubesmanager/qube_manager.py @@ -967,7 +967,7 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow): # vm could be deleted on renaming try: self.vms_in_table[vm.qid].update() - except exc.QubesPropertyAccessError: # pylint: disable=no-member + except exc.QubesPropertyAccessError(BaseExeption): pass @@ -1246,7 +1246,7 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow): self.logs_menu.setEnabled(not menu_empty) self.context_menu.exec_(self.table.mapToGlobal(point)) - except exc.QubesPropertyAccessError: # pylint: disable=no-member + except exc.QubesPropertyAccessError(BaseExeption): pass @QtCore.pyqtSlot('QAction *') diff --git a/qubesmanager/table_widgets.py b/qubesmanager/table_widgets.py index bdacd7e..9ac9f0b 100644 --- a/qubesmanager/table_widgets.py +++ b/qubesmanager/table_widgets.py @@ -85,7 +85,7 @@ class VmTypeWidget(VmIconWidget): elif self.value == other.value: return self.vm.name < other.vm.name return self.value < other.value - except exc.QubesPropertyAccessError: # pylint: disable=no-member + except exc.QubesPropertyAccessError(BaseException): return False def __init__(self, vm, parent=None): @@ -135,7 +135,7 @@ class VmLabelWidget(VmIconWidget): elif self.value == other.value: return self.vm.name < other.vm.name return self.value < other.value - except exc.QubesPropertyAccessError: # pylint: disable=no-member + except exc.QubesPropertyAccessError(BaseException): return False def __init__(self, vm, parent=None): @@ -166,7 +166,7 @@ class VmNameItem(QtGui.QTableWidgetItem): elif other.qid == 0: return False return super(VmNameItem, self).__lt__(other) - except exc.QubesPropertyAccessError: # pylint: disable=no-member + except exc.QubesPropertyAccessError(BaseException): return False @@ -212,7 +212,7 @@ class VmInfoWidget(QtGui.QWidget): return True elif other.vm.qid == 0: return False - except exc.QubesPropertyAccessError: # pylint: disable=no-member + except exc.QubesPropertyAccessError(BaseException): return False self_val = self.upd_info_item.value @@ -303,7 +303,7 @@ class VmTemplateItem(QtGui.QTableWidgetItem): elif self.text() == other.text(): return self.vm.name < other.vm.name return super(VmTemplateItem, self).__lt__(other) - except exc.QubesPropertyAccessError: # pylint: disable=no-member + except exc.QubesPropertyAccessError(BaseException): return False @@ -330,7 +330,7 @@ class VmNetvmItem(QtGui.QTableWidgetItem): elif self.text() == other.text(): return self.vm.name < other.vm.name return super(VmNetvmItem, self).__lt__(other) - except exc.QubesPropertyAccessError: # pylint: disable=no-member + except exc.QubesPropertyAccessError(BaseException): return False @@ -354,7 +354,7 @@ class VmInternalItem(QtGui.QTableWidgetItem): elif other.vm.qid == 0: return False return super(VmInternalItem, self).__lt__(other) - except exc.QubesPropertyAccessError: # pylint: disable=no-member + except exc.QubesPropertyAccessError(BaseException): return False @@ -384,7 +384,7 @@ class VmUpdateInfoWidget(QtGui.QWidget): elif self.value == other.value: return self.vm.name < other.vm.name return self.value < other.value - except exc.QubesPropertyAccessError: # pylint: disable=no-member + except exc.QubesPropertyAccessError(BaseException): return False def __init__(self, vm, show_text=True, parent=None): @@ -494,7 +494,7 @@ class VmSizeOnDiskItem(QtGui.QTableWidgetItem): elif self.value == other.value: return self.vm.name < other.vm.name return self.value < other.value - except exc.QubesPropertyAccessError: # pylint: disable=no-member + except exc.QubesPropertyAccessError(BaseException): return False @@ -517,7 +517,7 @@ class VmIPItem(QtGui.QTableWidgetItem): elif other.vm.qid == 0: return False return super(VmIPItem, self).__lt__(other) - except exc.QubesPropertyAccessError: # pylint: disable=no-member + except exc.QubesPropertyAccessError(BaseException): return False @@ -544,7 +544,7 @@ class VmIncludeInBackupsItem(QtGui.QTableWidgetItem): elif self.vm.include_in_backups == other.vm.include_in_backups: return self.vm.name < other.vm.name return self.vm.include_in_backups < other.vm.include_in_backups - except exc.QubesPropertyAccessError: # pylint: disable=no-member + except exc.QubesPropertyAccessError(BaseException): return False @@ -579,5 +579,5 @@ class VmLastBackupItem(QtGui.QTableWidgetItem): elif not other.backup_timestamp: return True return self.backup_timestamp < other.backup_timestamp - except exc.QubesPropertyAccessError: # pylint: disable=no-member + except exc.QubesPropertyAccessError(BaseException): return False From 3b1057c2e98923bd3d438d071512f5b83e457960 Mon Sep 17 00:00:00 2001 From: donoban Date: Thu, 14 Jun 2018 01:28:07 +0200 Subject: [PATCH 15/15] Revert last and removed pylint disables --- qubesmanager/qube_manager.py | 4 ++-- qubesmanager/table_widgets.py | 24 ++++++++++++------------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/qubesmanager/qube_manager.py b/qubesmanager/qube_manager.py index 4bcd672..c3e8f07 100644 --- a/qubesmanager/qube_manager.py +++ b/qubesmanager/qube_manager.py @@ -967,7 +967,7 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow): # vm could be deleted on renaming try: self.vms_in_table[vm.qid].update() - except exc.QubesPropertyAccessError(BaseExeption): + except exc.QubesPropertyAccessError: pass @@ -1246,7 +1246,7 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow): self.logs_menu.setEnabled(not menu_empty) self.context_menu.exec_(self.table.mapToGlobal(point)) - except exc.QubesPropertyAccessError(BaseExeption): + except exc.QubesPropertyAccessError: pass @QtCore.pyqtSlot('QAction *') diff --git a/qubesmanager/table_widgets.py b/qubesmanager/table_widgets.py index 9ac9f0b..8fca4f8 100644 --- a/qubesmanager/table_widgets.py +++ b/qubesmanager/table_widgets.py @@ -85,7 +85,7 @@ class VmTypeWidget(VmIconWidget): elif self.value == other.value: return self.vm.name < other.vm.name return self.value < other.value - except exc.QubesPropertyAccessError(BaseException): + except exc.QubesPropertyAccessError: return False def __init__(self, vm, parent=None): @@ -135,7 +135,7 @@ class VmLabelWidget(VmIconWidget): elif self.value == other.value: return self.vm.name < other.vm.name return self.value < other.value - except exc.QubesPropertyAccessError(BaseException): + except exc.QubesPropertyAccessError: return False def __init__(self, vm, parent=None): @@ -166,7 +166,7 @@ class VmNameItem(QtGui.QTableWidgetItem): elif other.qid == 0: return False return super(VmNameItem, self).__lt__(other) - except exc.QubesPropertyAccessError(BaseException): + except exc.QubesPropertyAccessError: return False @@ -212,7 +212,7 @@ class VmInfoWidget(QtGui.QWidget): return True elif other.vm.qid == 0: return False - except exc.QubesPropertyAccessError(BaseException): + except exc.QubesPropertyAccessError: return False self_val = self.upd_info_item.value @@ -303,7 +303,7 @@ class VmTemplateItem(QtGui.QTableWidgetItem): elif self.text() == other.text(): return self.vm.name < other.vm.name return super(VmTemplateItem, self).__lt__(other) - except exc.QubesPropertyAccessError(BaseException): + except exc.QubesPropertyAccessError: return False @@ -330,7 +330,7 @@ class VmNetvmItem(QtGui.QTableWidgetItem): elif self.text() == other.text(): return self.vm.name < other.vm.name return super(VmNetvmItem, self).__lt__(other) - except exc.QubesPropertyAccessError(BaseException): + except exc.QubesPropertyAccessError: return False @@ -354,7 +354,7 @@ class VmInternalItem(QtGui.QTableWidgetItem): elif other.vm.qid == 0: return False return super(VmInternalItem, self).__lt__(other) - except exc.QubesPropertyAccessError(BaseException): + except exc.QubesPropertyAccessError: return False @@ -384,7 +384,7 @@ class VmUpdateInfoWidget(QtGui.QWidget): elif self.value == other.value: return self.vm.name < other.vm.name return self.value < other.value - except exc.QubesPropertyAccessError(BaseException): + except exc.QubesPropertyAccessError: return False def __init__(self, vm, show_text=True, parent=None): @@ -494,7 +494,7 @@ class VmSizeOnDiskItem(QtGui.QTableWidgetItem): elif self.value == other.value: return self.vm.name < other.vm.name return self.value < other.value - except exc.QubesPropertyAccessError(BaseException): + except exc.QubesPropertyAccessError: return False @@ -517,7 +517,7 @@ class VmIPItem(QtGui.QTableWidgetItem): elif other.vm.qid == 0: return False return super(VmIPItem, self).__lt__(other) - except exc.QubesPropertyAccessError(BaseException): + except exc.QubesPropertyAccessError: return False @@ -544,7 +544,7 @@ class VmIncludeInBackupsItem(QtGui.QTableWidgetItem): elif self.vm.include_in_backups == other.vm.include_in_backups: return self.vm.name < other.vm.name return self.vm.include_in_backups < other.vm.include_in_backups - except exc.QubesPropertyAccessError(BaseException): + except exc.QubesPropertyAccessError: return False @@ -579,5 +579,5 @@ class VmLastBackupItem(QtGui.QTableWidgetItem): elif not other.backup_timestamp: return True return self.backup_timestamp < other.backup_timestamp - except exc.QubesPropertyAccessError(BaseException): + except exc.QubesPropertyAccessError: return False