from PySide6.QtWidgets import ( QWidget, QLabel, QVBoxLayout, QHBoxLayout, QScrollArea, ) from PySide6.QtCore import Qt from PySide6.QtGui import QFont, QGuiApplication from PySide6.QtWidgets import QScroller import build_info def build_about_screen() -> QWidget: screen = QWidget() layout = QVBoxLayout(screen) layout.setContentsMargins(0, 0, 0, 0) layout.setSpacing(12) scroll = QScrollArea() scroll.setWidgetResizable(True) scroll.setFrameShape(QScrollArea.NoFrame) scroll.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) scroll.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff) scroller = QScroller.scroller(scroll.viewport()) scroller.grabGesture( scroll.viewport(), QScroller.LeftMouseButtonGesture ) content = QWidget() content_layout = QVBoxLayout(content) content_layout.setContentsMargins(0, 0, 0, 0) content_layout.setSpacing(12) info = QVBoxLayout() info.setContentsMargins(0, 0, 0, 0) info.setSpacing(8) info.addWidget(_info_row("Приложение", build_info.APP_NAME)) info.addWidget(_info_row("Версия", build_info.VERSION)) info.addWidget(_info_row("Сборка", build_info.BUILD_DATE)) info.addWidget(_info_row("Коммит", build_info.GIT_HASH)) info.addWidget(_info_row("Устройство", build_info.get_device_model())) info.addWidget(_info_row("ОС", build_info.get_os_pretty_name())) info.addWidget(_info_row("Ядро", build_info.get_kernel_version())) info.addWidget(_info_row("RAM (используется/всего)", build_info.get_ram_info())) info.addWidget(_info_row("Диск (используется/всего)", build_info.get_disk_info())) info.addWidget(_info_row("Экран", build_info.get_display_resolution())) info.addWidget(_info_row("Экран (факт)", _get_runtime_resolution())) info.addWidget(_info_row("Серийный номер", build_info.get_serial_number())) info.addWidget(_info_row("IP", build_info.get_ip_address())) info.addWidget(_info_row("Температура CPU", build_info.get_cpu_temp())) content_layout.addLayout(info) content_layout.addStretch(1) scroll.setWidget(content) layout.addWidget(scroll) return screen def _info_row(label: str, value: str) -> QWidget: row = QWidget() layout = QHBoxLayout(row) layout.setContentsMargins(12, 6, 12, 6) layout.setSpacing(12) lbl = QLabel(label) lbl.setFont(QFont("", 15, 600)) val = QLabel(value) val.setFont(QFont("", 15)) val.setAlignment(Qt.AlignRight | Qt.AlignVCenter) layout.addWidget(lbl) layout.addStretch(1) layout.addWidget(val) return row def _get_runtime_resolution() -> str: app = QGuiApplication.instance() if app is None: return "—" screen = app.primaryScreen() if screen is None: return "—" size = screen.size() if size.isEmpty(): return "—" return f"{size.width()}x{size.height()}"