From 6b206d20507bc839ef378e4ad91de563de9ba42e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marta=20Marczykowska-G=C3=B3recka?= Date: Wed, 20 Jun 2018 21:01:49 +0200 Subject: [PATCH] Log dialog viewer as a separate tool Added entry point and main() to enable using log viewer as a separate tool. --- qubesmanager/log_dialog.py | 19 ++++++++++++++++++- rpm_spec/qmgr.spec.in | 1 + setup.py | 3 ++- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/qubesmanager/log_dialog.py b/qubesmanager/log_dialog.py index 0f4232b..f89c684 100644 --- a/qubesmanager/log_dialog.py +++ b/qubesmanager/log_dialog.py @@ -19,7 +19,7 @@ # with this program; if not, see . # # - +import sys from PyQt4 import QtCore # pylint: disable=import-error from PyQt4 import QtGui # pylint: disable=import-error @@ -27,6 +27,8 @@ from . import ui_logdlg # pylint: disable=no-name-in-module from . import clipboard import os +from qubesadmin import Qubes + # Display only this size of log LOG_DISPLAY_SIZE = 1024*1024 @@ -65,3 +67,18 @@ class LogDialog(ui_logdlg.Ui_LogDialog, QtGui.QDialog): def copy_to_clipboard_triggered(self): clipboard.copy_text_to_qubes_clipboard(self.displayed_text) + + +def main(): + qubes_app = Qubes() + qt_app = QtGui.QApplication(sys.argv) + + log_window = LogDialog(qubes_app, sys.argv[1]) + log_window.show() + + qt_app.exec_() + qt_app.exit() + + +if __name__ == "__main__": + main() diff --git a/rpm_spec/qmgr.spec.in b/rpm_spec/qmgr.spec.in index 51278bc..94b8900 100644 --- a/rpm_spec/qmgr.spec.in +++ b/rpm_spec/qmgr.spec.in @@ -66,6 +66,7 @@ rm -rf $RPM_BUILD_ROOT /usr/bin/qubes-backup /usr/bin/qubes-backup-restore /usr/bin/qubes-qube-manager +/usr/bin/qubes-log-viewer /usr/libexec/qubes-manager/mount_for_backup.sh /usr/libexec/qubes-manager/qvm_about.sh diff --git a/setup.py b/setup.py index 28d2c07..721284c 100644 --- a/setup.py +++ b/setup.py @@ -24,6 +24,7 @@ if __name__ == '__main__': 'qubes-vm-boot-from-device = qubesmanager.bootfromdevice:main', 'qubes-backup = qubesmanager.backup:main', 'qubes-backup-restore = qubesmanager.restore:main', - 'qubes-qube-manager = qubesmanager.qube_manager:main' + 'qubes-qube-manager = qubesmanager.qube_manager:main', + 'qubes-log-viewer = qubesmanager.log_dialog:main' ], })