diff --git a/qubesmanager/log_dialog.py b/qubesmanager/log_dialog.py index 18e8600..979b069 100644 --- a/qubesmanager/log_dialog.py +++ b/qubesmanager/log_dialog.py @@ -54,21 +54,13 @@ class LogDialog(ui_logdlg.Ui_LogDialog, QtWidgets.QDialog): btns_in_row = 3 count = 0 for log_path in self.logfiles: - if os.path.exists(log_path): - button = QtWidgets.QPushButton(log_path) - button.clicked.connect(partial(self.set_current_log, log_path)) - self.buttonsLayout.addWidget(button, - count / btns_in_row, count % btns_in_row) - count += 1 + button = QtWidgets.QPushButton(log_path) + button.clicked.connect(partial(self.set_current_log, log_path)) + self.buttonsLayout.addWidget(button, + count / btns_in_row, count % btns_in_row) + count += 1 - if count == 0: - QtWidgets.QMessageBox.warning( - self, - self.tr("Error"), - self.tr( - "No log files where found for current selection")) - else: - self.buttonsLayout.itemAt(0).widget().click() + self.buttonsLayout.itemAt(0).widget().click() def copy_to_clipboard_triggered(self): clipboard.copy_text_to_qubes_clipboard(self.displayed_text) diff --git a/qubesmanager/qube_manager.py b/qubesmanager/qube_manager.py index 35be98d..0edce50 100644 --- a/qubesmanager/qube_manager.py +++ b/qubesmanager/qube_manager.py @@ -24,6 +24,7 @@ import subprocess from datetime import datetime, timedelta from functools import partial +from os import path from qubesadmin import exc from qubesadmin import utils @@ -1526,8 +1527,18 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QMainWindow): "/var/log/qubes/qrexec." + vm.name + ".log", ]) - log_dlg = log_dialog.LogDialog(self.qt_app, logfiles) - log_dlg.exec_() + logfiles = list(filter(lambda x: path.exists(x), logfiles)) + + if len(logfiles) > 0: + log_dlg = log_dialog.LogDialog(self.qt_app, logfiles) + log_dlg.exec_() + else: + QMessageBox.warning( + self, + self.tr("Error"), + self.tr( + "No log files where found for the current selection.")) + except exc.QubesDaemonAccessError: pass