mirror of
https://github.com/blw1138/Zordon.git
synced 2025-12-17 08:48:13 +00:00
75 lines
2.3 KiB
Python
75 lines
2.3 KiB
Python
import os
|
|
import sys
|
|
|
|
from PyQt6.QtCore import Qt
|
|
from PyQt6.QtGui import QPixmap
|
|
from PyQt6.QtWidgets import QDialog, QVBoxLayout, QLabel, QDialogButtonBox, QHBoxLayout
|
|
|
|
from src.version import *
|
|
|
|
|
|
class AboutDialog(QDialog):
|
|
def __init__(self):
|
|
super().__init__()
|
|
self.setWindowTitle(f"About {APP_NAME}")
|
|
|
|
# Create the layout
|
|
layout = QVBoxLayout()
|
|
|
|
# App Icon
|
|
icon_name = 'Server.png' # todo: temp icon - replace with final later
|
|
icon_path = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))),
|
|
'resources', icon_name)
|
|
icon_label = QLabel(self)
|
|
icon_pixmap = QPixmap(icon_path)
|
|
icon_label.setPixmap(icon_pixmap)
|
|
icon_layout = QHBoxLayout()
|
|
icon_layout.addStretch()
|
|
icon_layout.addWidget(icon_label)
|
|
icon_layout.addStretch()
|
|
layout.addLayout(icon_layout)
|
|
|
|
# Application name
|
|
name_label = QLabel(f"<h2>{APP_NAME}</h2>")
|
|
layout.addWidget(name_label)
|
|
|
|
# Description
|
|
description_label = QLabel(APP_DESCRIPTION)
|
|
layout.addWidget(description_label)
|
|
|
|
# Version
|
|
version_label = QLabel(f"<strong>Version:</strong> {APP_VERSION}")
|
|
layout.addWidget(version_label)
|
|
|
|
# Contributors
|
|
contributors_label = QLabel(f"Copyright © {APP_COPYRIGHT_YEAR} {APP_AUTHOR}")
|
|
layout.addWidget(contributors_label)
|
|
|
|
# License
|
|
license_label = QLabel(f"Released under {APP_LICENSE}")
|
|
layout.addWidget(license_label)
|
|
|
|
# Add an "OK" button to close the dialog
|
|
button_box = QDialogButtonBox(QDialogButtonBox.StandardButton.Ok)
|
|
button_box.accepted.connect(self.accept)
|
|
layout.addWidget(button_box)
|
|
|
|
# Set the layout for the dialog
|
|
self.setLayout(layout)
|
|
|
|
# Make the dialog non-resizable
|
|
self.setWindowFlags(self.windowFlags() & ~Qt.WindowType.WindowContextHelpButtonHint)
|
|
self.setFixedSize(self.sizeHint())
|
|
|
|
|
|
if __name__ == '__main__':
|
|
# lazy load GUI frameworks
|
|
from PyQt6.QtWidgets import QApplication
|
|
|
|
# load application
|
|
app: QApplication = QApplication(sys.argv)
|
|
window: AboutDialog = AboutDialog()
|
|
window.show()
|
|
|
|
app.exec()
|