move files into a package structure

This commit is contained in:
2022-02-06 15:55:27 +01:00
parent 111c11d5d4
commit 8bb4ca0563
11 changed files with 8 additions and 7 deletions

View File

@@ -0,0 +1,83 @@
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 raven.ui.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://github.com/urllib3/urllib3">https://github.com/urllib3/urllib3</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

View File

@@ -1,11 +1,11 @@
import sys
from typing import Optional, Callable, Dict
from typing import Optional
from PySide6.QtCore import Qt
from PySide6.QtWidgets import QDockWidget, QMessageBox
import constants
from aboutdialog import AboutDialog
from raven.plugins.ravenlog.aboutdialog import AboutDialog
from raven.mainwindow import MainWindow
from raven.pluginbase import PluginBase
from raven.plugins.domain.menucontribution import MenuContribution