From a41e5b79a3d0635d29a417a804326edad950e28b Mon Sep 17 00:00:00 2001 From: Andreas Huber Date: Tue, 6 May 2025 20:14:59 +0200 Subject: [PATCH] add 'about qt' dialog --- constants.py | 1 + src/plugins/krowlog/about_qt_dialog.py | 79 ++++++++++++++++++++++++++ src/plugins/krowlogplugin.py | 10 ++++ 3 files changed, 90 insertions(+) create mode 100644 src/plugins/krowlog/about_qt_dialog.py diff --git a/constants.py b/constants.py index 2e54c21..2b15ca1 100644 --- a/constants.py +++ b/constants.py @@ -1,6 +1,7 @@ import os krow_icon = "icons" + os.sep + "krowlog.svg" +qt_icon = "icons" + os.sep + "qt-logo.png" license_file = os.path.dirname(os.path.realpath(__file__)) + os.sep + "LICENSE" changelog_file = os.path.dirname(os.path.realpath(__file__)) + os.sep + "changelog.txt" diff --git a/src/plugins/krowlog/about_qt_dialog.py b/src/plugins/krowlog/about_qt_dialog.py new file mode 100644 index 0000000..ad51c2e --- /dev/null +++ b/src/plugins/krowlog/about_qt_dialog.py @@ -0,0 +1,79 @@ +import textwrap + +import PySide6 +from PySide6.QtCore import Qt +from PySide6.QtGui import QFont, QPalette +from PySide6.QtWidgets import * + +import constants + +import krowlog +from src.ui.icon import Icon +from src.ui.label import Label +from src.ui.vbox import VBox +from src.i18n import _ + + +class AboutQTDialog(QDialog): + """Dialog for showing info about KrowLog""" + + def __init__(self, parent=None): + super(AboutQTDialog, self).__init__(parent) + self.setWindowTitle(_("About QT")) + self.setModal(True) + # self.setMinimumWidth(850) + # self.setFixedHeight(400) + + self.layout = QVBoxLayout(self) + + text = f""" + About QT +

This program uses QT version {PySide6.QtCore.__version__}.

+ +

QT is a C++ toolkit for cross-platform application development.

+ +

Qt provides single-source portability across all major desktop + operating systems. It is also available for embedded Linux and other + embedded and mobile operating systems.

+ +

Qt is available under multiple licensing options designed to accommodate + the needs of our various users.

+ +

Qt licensed under our commercial license agreement is appropriate for + development of proprietary/commercial software where you do not want to + share any source code with third parties or otherwise cannot comply with + the terms of GNU (L)GPL.

+ +

Qt licensed under GNU (L)GPL is appropriate for the development of Qt + applications provided you can comply with the terms and conditions of the + respective licenses.

+ + Please see qt.io/licensing for an< + overview of Qt licensing. + +

Copyright (C) 2025 The Qt Company Ltd and other contributors.

+ +

Qt and the Qt logo are trademarks of The Qt Company Ltd.

+ +

Qt is The Qt Company Ltd product developed as an open source project. + See qt.io for more information.

+ """ + label = Label(text) + label.setWordWrap(True) + + app_icon = QLabel() + app_icon.setPixmap(Icon(constants.qt_icon).pixmap(64, 64)) + heading = QWidget(self) + hbox = QHBoxLayout(heading) + hbox.addWidget(app_icon) + hbox.addWidget(label) + hbox.addSpacerItem(QSpacerItem(1, 1, hData=QSizePolicy.Policy.Expanding)) + + heading.layout = hbox + self.layout.addWidget(heading) + + buttons = QDialogButtonBox(self) + buttons.setStandardButtons(QDialogButtonBox.StandardButton.Close) + buttons.rejected.connect(self.close) + self.layout.addWidget(buttons) + self.setSizePolicy(QSizePolicy.Policy.MinimumExpanding, QSizePolicy.Policy.MinimumExpanding) diff --git a/src/plugins/krowlogplugin.py b/src/plugins/krowlogplugin.py index 2682565..1de180c 100644 --- a/src/plugins/krowlogplugin.py +++ b/src/plugins/krowlogplugin.py @@ -5,6 +5,7 @@ from PySide6.QtCore import Qt from PySide6.QtWidgets import QDockWidget, QMessageBox import constants +from src.plugins.krowlog.about_qt_dialog import AboutQTDialog from src.plugins.krowlog.aboutdialog import AboutDialog from src.mainwindow import MainWindow from src.pluginbase import PluginBase @@ -36,6 +37,7 @@ class KrowLogPlugin(PluginBase): return [ MenuContribution("file", action=self._action_close(), action_id="close application", after=""), MenuContribution("help", action=self._action_about(), action_id="open about dialog", after=""), + MenuContribution("help", action=self._action_about_qt(), action_id="open about QT dialog", after=""), MenuContribution("settings", menu=self._sub_menu_languages(), action_id="recent files menu"), ] @@ -108,6 +110,14 @@ class KrowLogPlugin(PluginBase): ) return about_action + def _action_about_qt(self) -> RAction: + action = RAction( + _("&About QT"), + action=lambda: AboutQTDialog().exec(), + icon_file=constants.qt_icon + ) + return action + def _action_close(self) -> RAction: icon = "close" if sys.platform == 'win32' or sys.platform == 'cygwin' else "exit" close_action = RAction(_("E&xit"), action=lambda: self.main_window.destruct(), shortcut='Ctrl+X',