add version and ok button to about dialog
This commit is contained in:
1
VERSION.info
Normal file
1
VERSION.info
Normal file
@@ -0,0 +1 @@
|
|||||||
|
0.1-alpha
|
||||||
@@ -5,6 +5,7 @@ from PyQt6.QtGui import QFont, QPixmap
|
|||||||
from PyQt6.QtWidgets import *
|
from PyQt6.QtWidgets import *
|
||||||
|
|
||||||
from label import Label
|
from label import Label
|
||||||
|
from vbox import VBox
|
||||||
|
|
||||||
|
|
||||||
class AboutDialog(QDialog):
|
class AboutDialog(QDialog):
|
||||||
@@ -21,12 +22,16 @@ class AboutDialog(QDialog):
|
|||||||
heading_app_name.setAlignment(Qt.AlignmentFlag.AlignLeft)
|
heading_app_name.setAlignment(Qt.AlignmentFlag.AlignLeft)
|
||||||
heading_app_name.setFont(QFont("default", 25))
|
heading_app_name.setFont(QFont("default", 25))
|
||||||
heading_app_name.setTextInteractionFlags(Qt.TextInteractionFlag.TextSelectableByMouse)
|
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 = QLabel()
|
||||||
app_icon.setPixmap(QPixmap("icon7.png"))
|
app_icon.setPixmap(QPixmap("icon7.png"))
|
||||||
heading = QWidget(self)
|
heading = QWidget(self)
|
||||||
hbox = QHBoxLayout(heading)
|
hbox = QHBoxLayout(heading)
|
||||||
hbox.addWidget(app_icon)
|
hbox.addWidget(app_icon)
|
||||||
hbox.addWidget(heading_app_name)
|
hbox.addWidget(VBox(heading_app_name, version))
|
||||||
hbox.addSpacerItem(QSpacerItem(1, 1, hPolicy=QSizePolicy.Policy.Expanding))
|
hbox.addSpacerItem(QSpacerItem(1, 1, hPolicy=QSizePolicy.Policy.Expanding))
|
||||||
|
|
||||||
heading.layout = hbox
|
heading.layout = hbox
|
||||||
@@ -38,6 +43,11 @@ class AboutDialog(QDialog):
|
|||||||
|
|
||||||
self.layout.addWidget(tabs)
|
self.layout.addWidget(tabs)
|
||||||
|
|
||||||
|
buttons = QDialogButtonBox(self)
|
||||||
|
buttons.setStandardButtons(QDialogButtonBox.StandardButton.Ok)
|
||||||
|
buttons.accepted.connect(self.close)
|
||||||
|
self.layout.addWidget(buttons)
|
||||||
|
|
||||||
def _about(self) -> QWidget:
|
def _about(self) -> QWidget:
|
||||||
result = QWidget()
|
result = QWidget()
|
||||||
result.layout = QVBoxLayout(result)
|
result.layout = QVBoxLayout(result)
|
||||||
@@ -53,7 +63,14 @@ class AboutDialog(QDialog):
|
|||||||
result.layout = QVBoxLayout(result)
|
result.layout = QVBoxLayout(result)
|
||||||
result.layout.addWidget(Label(self.tr(textwrap.dedent("""
|
result.layout.addWidget(Label(self.tr(textwrap.dedent("""
|
||||||
<ul>
|
<ul>
|
||||||
<li>PyQt6 6.2.1 (GPL v3) - <a href="https://code.qt.io/cgit/qt/qtbase.git/">https://code.qt.io/cgit/qt/qtbase.git/</a></li>
|
<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>
|
<li>watchdog 2.16 (Apache 2.0)</li>
|
||||||
</ul>"""))))
|
</ul>"""))))
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
def _version(self):
|
||||||
|
with open('VERSION.info', "rt") as f:
|
||||||
|
line = f.readline()
|
||||||
|
version = line.strip()
|
||||||
|
return version
|
||||||
|
|||||||
Reference in New Issue
Block a user