From eda8d43b9c24ffa9d9d9ca103ece503cdb9d949c Mon Sep 17 00:00:00 2001 From: benya Date: Sun, 15 Feb 2026 21:16:33 +0300 Subject: [PATCH] refactor(ui): simplify instructions and stabilize About dialog - remove duplicated inline instruction text - switch About dialog to explicit QDialog with clickable link --- main.py | 50 ++++++++++++++++++++------------------------------ 1 file changed, 20 insertions(+), 30 deletions(-) diff --git a/main.py b/main.py index 8425bdb..da50378 100644 --- a/main.py +++ b/main.py @@ -21,7 +21,7 @@ from ui.main_window import instructions_text from PySide6.QtWidgets import (QApplication, QMainWindow, QLabel, QLineEdit, QPushButton, QVBoxLayout, QWidget, QMessageBox, QTextBrowser, QScrollArea, QCheckBox, QHBoxLayout, - QSizePolicy, QTabWidget, + QSizePolicy, QTabWidget, QDialog, QDialogButtonBox, QProgressBar) from PySide6.QtCore import Qt, QUrl, QDateTime, QTimer from PySide6.QtGui import QIcon, QAction, QDesktopServices @@ -103,14 +103,6 @@ class VkChatManager(QMainWindow): layout.setSpacing(5) self.instructions = QTextBrowser() - self.instructions.setPlainText( - "Инструкция:\n" - "1. Авторизуйтесь через VK.\n" - "2. Выберите чаты.\n" - "3. Вставьте ссылку на пользователя в поле ниже. ID определится автоматически.\n" - "4. Для массовых операций, нажмите кнопку 'Список' и вставьте ссылки в окне.\n" - "5. Нажмите 'ИСКЛЮЧИТЬ' или 'ПРИГЛАСИТЬ'." - ) self.instructions.setFixedHeight(120) self.instructions.setPlainText(instructions_text()) layout.addWidget(self.instructions) @@ -252,35 +244,33 @@ class VkChatManager(QMainWindow): self.about_action = about_action def show_about_dialog(self): - message_box = QMessageBox(self) - message_box.setWindowTitle("О приложении") - message_box.setIcon(QMessageBox.Information) - message_box.setTextFormat(Qt.RichText) - + dialog = QDialog(self) + dialog.setWindowTitle("О приложении") + dialog.setMinimumWidth(460) repo_url = self.update_repository_url if repo_url: repo_html = f'{repo_url}' else: repo_html = "не указан" - - message_box.setText( - ( - f"Anabasis Chat Manager
" - f"Версия: {APP_VERSION}

" - "Инструмент для массового управления пользователями в чатах VK.
" - "Поддерживается проверка обновлений и автообновление Windows-сборки.

" - f"Репозиторий: {repo_html}" - ) + content = QLabel( + f"Anabasis Chat Manager
" + f"Версия: {APP_VERSION}

" + "Инструмент для массового управления пользователями в чатах VK.
" + "Поддерживается проверка обновлений и автообновление Windows-сборки.

" + f"Репозиторий: {repo_html}" ) + content.setTextFormat(Qt.RichText) + content.setTextInteractionFlags(Qt.TextBrowserInteraction) + content.setOpenExternalLinks(True) + content.setWordWrap(True) - # QMessageBox не имеет setOpenExternalLinks, настраиваем его внутренний QLabel. - for label in message_box.findChildren(QLabel): - if "href=" in label.text(): - label.setTextInteractionFlags(Qt.TextBrowserInteraction) - label.setOpenExternalLinks(True) - break + button_box = QDialogButtonBox(QDialogButtonBox.Ok, parent=dialog) + button_box.accepted.connect(dialog.accept) - message_box.exec() + layout = QVBoxLayout(dialog) + layout.addWidget(content) + layout.addWidget(button_box) + dialog.exec() def create_chat_tab(self): # This implementation correctly creates a scrollable area for chat lists.