/
Flipper
/
Marginal
Обзор
Документация
Войти
/
Flipper
/
Marginal
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
1
CI/CD
Аналитика
Безопасность
master
src/UI/AboutDialog.py
92 строки
3 KB
Alex
Marginal v1.0.0 RELEASE
11 янв 2026, 18:02
11 янв 2026, 18:02
5e1eff8
Код
Авторство
О чём код?
from PySide6.QtWidgets import QDialog, QVBoxLayout, QLabel from PySide6.QtGui import QFont, QIcon from PySide6.QtCore import Qt from src.utils import getBakedPath from os import path class AboutDialog(QDialog): """ Displays an "About" dialog with application information, version details, and ASCII art from a file. """ def __init__(self, backbone): """ Initialize AboutDialog with application backbone. Args: backbone (Backbone): Central application controller. """ super().__init__() self.backbone = backbone self.translate = self.backbone.translator.translate self.version = self.backbone.getMeta("version") self.versionFlag = self.backbone.getMeta("versionFlag") # Path to ASCII art file in bundled/local directory self.artFile = path.join(getBakedPath(), r"local\app_asciiArt.txt") self.initWindow() self.setUpContent() def initWindow(self): """ Initialize dialog window properties (title, icon, size). Returns: None """ self.setWindowTitle(self.translate("About Marginal")) self.setWindowIcon(QIcon(":/resources/sprites/Icon_small.png")) self.setFixedSize(500, 300) def loadAsciiArt(self) -> str: """ Load ASCII art from file, with fallback text if file not found. Returns: str -> ASCII art content or fallback message. """ try: with open(self.artFile, 'r', encoding='utf-8') as f: return f.read() except FileNotFoundError: return r"""Hi, how are ya?""" # Fallback ASCII art def setUpContent(self): """ Set up dialog layout with ASCII art, application info, and disclaimer. Returns: None """ layout = QVBoxLayout() # ASCII Art display asciiArt = QLabel(self.loadAsciiArt()) asciiArt.setObjectName("ascii_art_widget") # Application information (name, version) appInfo = QLabel( f"{self.translate('Dynamic lab work result processor "MARGINAL" by FLIPPER @ 2025\nVersion')}: " f"{self.version}-{self.versionFlag}" ) appInfo.setAlignment(Qt.AlignCenter) appInfo.setFont(QFont("Arial", 10)) # Legal disclaimer disclaimer = QLabel( f"{self.translate('Developed for BMSTU. Internal use only.')}\n" f"{self.translate('©2025 FLIPPER. ALL RIGHTS RESERVED.')}" ) disclaimer.setAlignment(Qt.AlignCenter) disclaimer.setFont(QFont("Arial", 8)) disclaimer.setStyleSheet("color: gray;") # Add widgets to layout with alignment layout.addWidget(asciiArt, alignment=Qt.AlignCenter) layout.addWidget(appInfo) layout.addWidget(disclaimer, alignment=Qt.AlignBottom) self.setLayout(layout)