File checking and error dialog moved to qube_manager

This commit is contained in:
donoban 2020-12-11 00:53:57 +01:00
parent 78d76eb70f
commit df0e4699a0
No known key found for this signature in database
GPG Key ID: 141310D8E3ED08A5
2 changed files with 19 additions and 16 deletions

View File

@ -54,20 +54,12 @@ 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
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()
def copy_to_clipboard_triggered(self):

View File

@ -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",
])
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