feat(core): 优化主窗口和UI管理功能

- 移除不再使用的UI组件,简化主窗口代码结构。
- 更新按钮状态管理,统一通过UIManager控制安装按钮状态,提升代码可读性。
- 优化解压和下载管理逻辑,确保在操作过程中提供清晰的用户反馈。
- 增强日志记录,确保在关键操作中提供详细的调试信息,便于后续排查和用户反馈。
This commit is contained in:
hyb-oyqq
2025-08-12 17:11:09 +08:00
parent 2c91319d5f
commit 4f2217ca95
10 changed files with 159 additions and 128 deletions

View File

@@ -5,6 +5,7 @@ from PySide6.QtWidgets import QMessageBox
from PySide6.QtCore import QTimer, QCoreApplication
from utils.logger import setup_logger
from workers.extraction_thread import ExtractionThread
# 初始化logger
logger = setup_logger("extraction_handler")
@@ -45,8 +46,8 @@ class ExtractionHandler:
QCoreApplication.processEvents()
# 创建并启动解压线程
self.main_window.extraction_thread = self.main_window.create_extraction_thread(
_7z_path, game_folder, plugin_path, game_version, extracted_path
self.main_window.extraction_thread = ExtractionThread(
_7z_path, game_folder, plugin_path, game_version, self.main_window, extracted_path
)
# 连接进度信号
@@ -109,7 +110,7 @@ class ExtractionHandler:
self.main_window.download_manager.on_extraction_finished(True)
else:
# 用户选择停止,保持窗口启用状态
self.main_window.ui.start_install_text.setText("开始安装")
self.main_window.ui_manager.set_install_button_state("ready")
# 通知DownloadManager停止下载队列
self.main_window.download_manager.on_extraction_finished(False)
return

View File

@@ -94,7 +94,7 @@ class PatchToggleHandler(QObject):
selected_game_dirs = {game: games_with_patch[game]["dir"] for game in selected_games if game in games_with_patch}
self._execute_batch_toggle(selected_game_dirs, operation, self.debug_manager.debug_mode)
self._execute_batch_toggle(selected_game_dirs, operation, self.debug_manager._is_debug_mode)
def _handle_multiple_games(self, game_dirs, debug_mode):
"""