84 lines
3.0 KiB
Python
84 lines
3.0 KiB
Python
import textwrap
|
|
|
|
import PySide6
|
|
from PySide6.QtCore import Qt
|
|
from PySide6.QtGui import QFont, QPixmap
|
|
from PySide6.QtWidgets import *
|
|
|
|
import constants
|
|
from label import Label
|
|
from vbox import VBox
|
|
from raven.i18n import _
|
|
|
|
class AboutDialog(QDialog):
|
|
"""Dialog for showing info about RavenLog"""
|
|
|
|
def __init__(self, parent=None):
|
|
super(AboutDialog, self).__init__(parent)
|
|
self.setWindowTitle(_("About RavenLog"))
|
|
self.setModal(True)
|
|
|
|
self.layout = QVBoxLayout(self)
|
|
|
|
heading_app_name = QLabel(_("RavenLog"))
|
|
heading_app_name.setAlignment(Qt.AlignmentFlag.AlignLeft)
|
|
heading_app_name.setFont(QFont("default", 25))
|
|
heading_app_name.setTextInteractionFlags(Qt.TextInteractionFlag.TextSelectableByMouse)
|
|
|
|
version = QLabel(_("Version: {0}".format(self._version())))
|
|
version.setAlignment(Qt.AlignmentFlag.AlignLeft)
|
|
|
|
app_icon = QLabel()
|
|
app_icon.setPixmap(QPixmap(constants.raven_icon))
|
|
heading = QWidget(self)
|
|
hbox = QHBoxLayout(heading)
|
|
hbox.addWidget(app_icon)
|
|
hbox.addWidget(VBox(heading_app_name, version))
|
|
hbox.addSpacerItem(QSpacerItem(1, 1, hData=QSizePolicy.Policy.Expanding))
|
|
|
|
heading.layout = hbox
|
|
self.layout.addWidget(heading)
|
|
|
|
tabs = QTabWidget()
|
|
tabs.addTab(self._about(), _("About"))
|
|
tabs.addTab(self._license(), _("License"))
|
|
|
|
self.layout.addWidget(tabs)
|
|
|
|
buttons = QDialogButtonBox(self)
|
|
buttons.setStandardButtons(QDialogButtonBox.StandardButton.Close)
|
|
buttons.rejected.connect(self.close)
|
|
self.layout.addWidget(buttons)
|
|
|
|
def _about(self) -> QWidget:
|
|
result = QWidget()
|
|
result.layout = QVBoxLayout(result)
|
|
label = Label(_(textwrap.dedent("""
|
|
Log file viewer<br>
|
|
(c) 2022 Open Text Corporation<br>
|
|
<a href="https://www.opentext.com/">License: LGPL v3</a>""")))
|
|
result.layout.addWidget(label)
|
|
return result
|
|
|
|
def _license(self) -> QWidget:
|
|
dependencies = """
|
|
<ul>
|
|
<li>PySide6 {pyside} (LGPL v3) - <a href="https://doc.qt.io/qtforpython-6/">https://doc.qt.io/qtforpython-6/</a></li>
|
|
<li>Qt6 {qt} (LGPL v3) - <a href="https://code.qt.io/cgit/qt/qtbase.git/">https://code.qt.io/cgit/qt/qtbase.git/</a></li>
|
|
<li>urllib3 (MIT) - <a href="https://urllib3.readthedocs.io/en/stable/">https://urllib3.readthedocs.io/en/stable/</a></li>
|
|
<li>watchdog 2.16 (Apache 2.0) - <a href="https://github.com/gorakhargosh/watchdog">https://github.com/gorakhargosh/watchdog</a></li>
|
|
</ul>""".format(pyside=PySide6.__version__, qt=PySide6.QtCore.__version__)
|
|
label = _(textwrap.dedent(dependencies))
|
|
|
|
result = QWidget()
|
|
result.layout = QVBoxLayout(result)
|
|
result.layout.addWidget(Label(label))
|
|
return result
|
|
|
|
def _version(self):
|
|
with open('VERSION.info', "rt") as f:
|
|
line = f.readline()
|
|
version = line.strip()
|
|
return version
|
|
|