78 lines
2.5 KiB
Python
78 lines
2.5 KiB
Python
import textwrap
|
|
|
|
from PyQt6.QtCore import Qt
|
|
from PyQt6.QtGui import QFont, QPixmap
|
|
from PyQt6.QtWidgets import *
|
|
|
|
import constants
|
|
from label import Label
|
|
from vbox import VBox
|
|
|
|
|
|
class AboutDialog(QDialog):
|
|
"""Dialog for showing info about RavenLog"""
|
|
|
|
def __init__(self, parent=None):
|
|
super(AboutDialog, self).__init__(parent)
|
|
self.setWindowTitle(self.tr("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(self.tr("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, hPolicy=QSizePolicy.Policy.Expanding))
|
|
|
|
heading.layout = hbox
|
|
self.layout.addWidget(heading)
|
|
|
|
tabs = QTabWidget()
|
|
tabs.addTab(self._about(), self.tr("About"))
|
|
tabs.addTab(self._license(), self.tr("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(self.tr(textwrap.dedent("""
|
|
Log file viewer<br>
|
|
(c) 2021 Open Text Corporation<br>
|
|
<a href="https://www.opentext.com/">License: GPL</a>""")))
|
|
result.layout.addWidget(label)
|
|
return result
|
|
|
|
def _license(self) -> QWidget:
|
|
result = QWidget()
|
|
result.layout = QVBoxLayout(result)
|
|
result.layout.addWidget(Label(self.tr(textwrap.dedent("""
|
|
<ul>
|
|
<li>PyQt6 6.2.1 (GPL v3)</li>
|
|
<li>Qt6 6.2.1 (LGPL v3) - <a href="https://code.qt.io/cgit/qt/qtbase.git/">https://code.qt.io/cgit/qt/qtbase.git/</a></li>
|
|
<li>watchdog 2.16 (Apache 2.0)</li>
|
|
</ul>"""))))
|
|
return result
|
|
|
|
def _version(self):
|
|
with open('VERSION.info', "rt") as f:
|
|
line = f.readline()
|
|
version = line.strip()
|
|
return version
|