diff --git a/source/IMG/ICO/cloudflare_logo_icon.ico b/source/IMG/ICO/cloudflare_logo_icon.ico new file mode 100644 index 0000000..0c58cfc Binary files /dev/null and b/source/IMG/ICO/cloudflare_logo_icon.ico differ diff --git a/source/core/download_manager.py b/source/core/download_manager.py index aff68f7..5023e53 100644 --- a/source/core/download_manager.py +++ b/source/core/download_manager.py @@ -6,8 +6,9 @@ from urllib.parse import urlparse from PySide6 import QtWidgets from PySide6.QtCore import Qt +from PySide6.QtGui import QIcon, QPixmap -from utils import msgbox_frame, HostsManager +from utils import msgbox_frame, HostsManager, resource_path from data.config import APP_NAME, PLUGIN, GAME_INFO, UA, CONFIG_URL from workers import IpOptimizerThread @@ -185,7 +186,17 @@ class DownloadManager: msg_box = QtWidgets.QMessageBox(self.main_window) msg_box.setWindowTitle(f"下载优化 - {APP_NAME}") msg_box.setText("是否愿意通过Cloudflare加速来优化下载速度?\n\n这将临时修改系统的hosts文件,并需要管理员权限。") - msg_box.setIcon(QtWidgets.QMessageBox.Icon.Question) + + # 设置Cloudflare图标 + cf_icon_path = resource_path("IMG/ICO/cloudflare_logo_icon.ico") + if os.path.exists(cf_icon_path): + cf_pixmap = QPixmap(cf_icon_path) + if not cf_pixmap.isNull(): + msg_box.setWindowIcon(QIcon(cf_pixmap)) + msg_box.setIconPixmap(cf_pixmap.scaled(64, 64, Qt.AspectRatioMode.KeepAspectRatio, + Qt.TransformationMode.SmoothTransformation)) + else: + msg_box.setIcon(QtWidgets.QMessageBox.Icon.Question) yes_button = msg_box.addButton("是,开启加速", QtWidgets.QMessageBox.ButtonRole.YesRole) no_button = msg_box.addButton("否,直接下载", QtWidgets.QMessageBox.ButtonRole.NoRole) @@ -240,10 +251,21 @@ class DownloadManager: # 禁用退出按钮 self.main_window.ui.exit_btn.setEnabled(False) + # 使用Cloudflare图标创建消息框 + self.optimizing_msg_box = msgbox_frame( f"通知 - {APP_NAME}", "\n正在优选Cloudflare IP,请稍候...\n\n这可能需要5-10分钟,请耐心等待喵~" ) + # 设置Cloudflare图标 + cf_icon_path = resource_path("IMG/ICO/cloudflare_logo_icon.ico") + if os.path.exists(cf_icon_path): + cf_pixmap = QPixmap(cf_icon_path) + if not cf_pixmap.isNull(): + self.optimizing_msg_box.setWindowIcon(QIcon(cf_pixmap)) + self.optimizing_msg_box.setIconPixmap(cf_pixmap.scaled(64, 64, Qt.AspectRatioMode.KeepAspectRatio, + Qt.TransformationMode.SmoothTransformation)) + # 我们不再提供"跳过"按钮 self.optimizing_msg_box.setStandardButtons(QtWidgets.QMessageBox.StandardButton.NoButton) self.optimizing_msg_box.setWindowModality(Qt.WindowModality.ApplicationModal) diff --git a/source/data/config.py b/source/data/config.py index b378545..01879cf 100644 --- a/source/data/config.py +++ b/source/data/config.py @@ -3,7 +3,7 @@ import base64 # 配置信息 app_data = { - "APP_VERSION": "1.1.2.1", + "APP_VERSION": "1.1.3", "APP_NAME": "FRAISEMOE Addons Installer NEXT", "TEMP": "TEMP", "CACHE": "FRAISEMOE", diff --git a/source/resources/data/ip.txt b/source/data/ip.txt similarity index 100% rename from source/resources/data/ip.txt rename to source/data/ip.txt diff --git a/source/resources/data/ipv6.txt b/source/data/ipv6.txt similarity index 100% rename from source/resources/data/ipv6.txt rename to source/data/ipv6.txt diff --git a/source/main_window.py b/source/main_window.py index bcba254..b3534d9 100644 --- a/source/main_window.py +++ b/source/main_window.py @@ -2,6 +2,7 @@ import os import sys import shutil import json +import webbrowser from PySide6 import QtWidgets from PySide6.QtCore import QTimer @@ -36,6 +37,7 @@ class MainWindow(QMainWindow): # 初始化状态变量 self.cloud_config = None + self.config_valid = False # 添加配置有效标志 self.installed_status = {f"NEKOPARA Vol.{i}": False for i in range(1, 5)} self.installed_status["NEKOPARA After"] = False # 添加After的状态 self.hash_msg_box = None @@ -111,8 +113,11 @@ class MainWindow(QMainWindow): """动画完成后启用按钮""" self.animation_in_progress = False - # 启用开始安装按钮 - self.ui.start_install_btn.setEnabled(True) + # 只有在配置有效时才启用开始安装按钮 + if self.config_valid: + self.ui.start_install_btn.setEnabled(True) + else: + self.ui.start_install_btn.setEnabled(False) def fetch_cloud_config(self): """获取云端配置""" @@ -130,6 +135,9 @@ class MainWindow(QMainWindow): error_message: 错误信息,如果有 """ if error_message: + # 标记配置无效 + self.config_valid = False + if error_message == "update_required": msg_box = msgbox_frame( f"更新提示 - {APP_NAME}", @@ -137,8 +145,11 @@ class MainWindow(QMainWindow): QMessageBox.StandardButton.Ok, ) msg_box.exec() - self.ui_manager.open_project_home_page() + # 在浏览器中打开项目主页 + webbrowser.open("https://github.com/hyb-oyqq/FRAISEMOE-Addons-Installer-NEXT/") + # 强制关闭程序 self.shutdown_app(force_exit=True) + return elif "missing_keys" in error_message: missing_versions = error_message.split(":")[1] msg_box = msgbox_frame( @@ -147,17 +158,38 @@ class MainWindow(QMainWindow): QMessageBox.StandardButton.Ok, ) msg_box.exec() + # 对于部分缺失,仍然允许使用,因为可能只影响部分游戏版本 + self.config_valid = True else: - # 其他错误暂时只在debug模式下打印 + # 显示通用错误消息,只在debug模式下显示详细错误 debug_mode = self.ui_manager.debug_action.isChecked() if self.ui_manager.debug_action else False - if debug_mode: - print(f"获取云端配置失败: {error_message}") + error_msg = "访问云端配置失败,请检查网络状况或稍后再试。" + if debug_mode and "详细错误:" in error_message: + msg_box = msgbox_frame( + f"错误 - {APP_NAME}", + f"\n{error_message}\n", + QMessageBox.StandardButton.Ok, + ) + else: + msg_box = msgbox_frame( + f"错误 - {APP_NAME}", + f"\n{error_msg}\n", + QMessageBox.StandardButton.Ok, + ) + msg_box.exec() + # 在无法连接到云端时禁用开始安装按钮 + self.ui.start_install_btn.setEnabled(False) else: self.cloud_config = data + # 标记配置有效 + self.config_valid = True + debug_mode = self.ui_manager.debug_action.isChecked() if self.ui_manager.debug_action else False if debug_mode: print("--- Cloud config fetched successfully ---") print(json.dumps(data, indent=2)) + # 确保按钮在成功获取配置时启用 + self.ui.start_install_btn.setEnabled(True) def toggle_debug_mode(self, checked): """切换调试模式 diff --git a/source/resources/icons/icon.ico b/source/resources/icons/icon.ico deleted file mode 100644 index 4bf517d..0000000 Binary files a/source/resources/icons/icon.ico and /dev/null differ diff --git a/source/resources/images/After/voaf_ga01.jpg b/source/resources/images/After/voaf_ga01.jpg deleted file mode 100644 index 9412413..0000000 Binary files a/source/resources/images/After/voaf_ga01.jpg and /dev/null differ diff --git a/source/resources/images/After/voaf_ga02.jpg b/source/resources/images/After/voaf_ga02.jpg deleted file mode 100644 index a5377d5..0000000 Binary files a/source/resources/images/After/voaf_ga02.jpg and /dev/null differ diff --git a/source/resources/images/BG/bg1.jpg b/source/resources/images/BG/bg1.jpg deleted file mode 100644 index 9dbe5b5..0000000 Binary files a/source/resources/images/BG/bg1.jpg and /dev/null differ diff --git a/source/resources/images/BG/bg2.jpg b/source/resources/images/BG/bg2.jpg deleted file mode 100644 index e83bcf1..0000000 Binary files a/source/resources/images/BG/bg2.jpg and /dev/null differ diff --git a/source/resources/images/BG/bg3.jpg b/source/resources/images/BG/bg3.jpg deleted file mode 100644 index 2acb228..0000000 Binary files a/source/resources/images/BG/bg3.jpg and /dev/null differ diff --git a/source/resources/images/BG/bg4.jpg b/source/resources/images/BG/bg4.jpg deleted file mode 100644 index dbed973..0000000 Binary files a/source/resources/images/BG/bg4.jpg and /dev/null differ diff --git a/source/resources/images/BG/menubg.jpg b/source/resources/images/BG/menubg.jpg deleted file mode 100644 index 9cde541..0000000 Binary files a/source/resources/images/BG/menubg.jpg and /dev/null differ diff --git a/source/resources/images/BTN/exit.bmp b/source/resources/images/BTN/exit.bmp deleted file mode 100644 index 93303e3..0000000 Binary files a/source/resources/images/BTN/exit.bmp and /dev/null differ diff --git a/source/resources/images/BTN/start_install.bmp b/source/resources/images/BTN/start_install.bmp deleted file mode 100644 index b9b7404..0000000 Binary files a/source/resources/images/BTN/start_install.bmp and /dev/null differ diff --git a/source/resources/images/ICO/icon.ico b/source/resources/images/ICO/icon.ico deleted file mode 100644 index 4bf517d..0000000 Binary files a/source/resources/images/ICO/icon.ico and /dev/null differ diff --git a/source/resources/images/ICO/icon.png b/source/resources/images/ICO/icon.png deleted file mode 100644 index d5ca97d..0000000 Binary files a/source/resources/images/ICO/icon.png and /dev/null differ diff --git a/source/resources/images/LOGO/gl_head_logo_jp.png b/source/resources/images/LOGO/gl_head_logo_jp.png deleted file mode 100644 index fe01f25..0000000 Binary files a/source/resources/images/LOGO/gl_head_logo_jp.png and /dev/null differ diff --git a/source/resources/images/LOGO/vo01_logo.png b/source/resources/images/LOGO/vo01_logo.png deleted file mode 100644 index e88567b..0000000 Binary files a/source/resources/images/LOGO/vo01_logo.png and /dev/null differ diff --git a/source/resources/images/LOGO/vo02_logo.png b/source/resources/images/LOGO/vo02_logo.png deleted file mode 100644 index a8b948c..0000000 Binary files a/source/resources/images/LOGO/vo02_logo.png and /dev/null differ diff --git a/source/resources/images/LOGO/vo03_logo.png b/source/resources/images/LOGO/vo03_logo.png deleted file mode 100644 index 6273e6b..0000000 Binary files a/source/resources/images/LOGO/vo03_logo.png and /dev/null differ diff --git a/source/resources/images/LOGO/vo04_logo.png b/source/resources/images/LOGO/vo04_logo.png deleted file mode 100644 index f110beb..0000000 Binary files a/source/resources/images/LOGO/vo04_logo.png and /dev/null differ diff --git a/source/resources/images/LOGO/voaf_logo.png b/source/resources/images/LOGO/voaf_logo.png deleted file mode 100644 index 3470111..0000000 Binary files a/source/resources/images/LOGO/voaf_logo.png and /dev/null differ diff --git a/source/resources/images/vol4/vo04_ga01.jpg b/source/resources/images/vol4/vo04_ga01.jpg deleted file mode 100644 index 8bc9bf0..0000000 Binary files a/source/resources/images/vol4/vo04_ga01.jpg and /dev/null differ diff --git a/source/resources/images/vol4/vo04_ga05.jpg b/source/resources/images/vol4/vo04_ga05.jpg deleted file mode 100644 index 4afc4de..0000000 Binary files a/source/resources/images/vol4/vo04_ga05.jpg and /dev/null differ diff --git a/source/resources/images/vol4/vo04_ga06.jpg b/source/resources/images/vol4/vo04_ga06.jpg deleted file mode 100644 index be16715..0000000 Binary files a/source/resources/images/vol4/vo04_ga06.jpg and /dev/null differ diff --git a/source/resources/images/vol4/vo04_ga07.jpg b/source/resources/images/vol4/vo04_ga07.jpg deleted file mode 100644 index 86cf2c3..0000000 Binary files a/source/resources/images/vol4/vo04_ga07.jpg and /dev/null differ diff --git a/source/utils/helpers.py b/source/utils/helpers.py index b5d580b..09f48b5 100644 --- a/source/utils/helpers.py +++ b/source/utils/helpers.py @@ -28,7 +28,7 @@ def resource_path(relative_path): if relative_path in ("aria2c.exe", "cfst.exe"): return os.path.join(base_path, 'bin', relative_path) elif relative_path in ("ip.txt", "ipv6.txt"): - return os.path.join(base_path, 'resources', 'data', relative_path) + return os.path.join(base_path, 'data', relative_path) return os.path.join(base_path, relative_path) diff --git a/source/workers/config_fetch_thread.py b/source/workers/config_fetch_thread.py index 289545c..fe4ae5d 100644 --- a/source/workers/config_fetch_thread.py +++ b/source/workers/config_fetch_thread.py @@ -1,6 +1,9 @@ import json import requests +import webbrowser from PySide6.QtCore import QThread, Signal +from PySide6.QtWidgets import QMessageBox +import sys class ConfigFetchThread(QThread): finished = Signal(object, str) # data, error_message @@ -30,8 +33,12 @@ class ConfigFetchThread(QThread): # 首先,总是尝试解析JSON config_data = response.json() - # 检查是否是要求更新的错误信息 - if config_data.get("message") == "请使用最新版本的FRAISEMOE Addons Installer NEXT进行下载安装": + # 检查是否是要求更新的错误信息 - 使用Unicode编码的更新提示文本 + update_required_msg = "\u8bf7\u4f7f\u7528\u6700\u65b0\u7248\u672c\u7684FraiseMoe2-Next\u8fdb\u884c\u4e0b\u8f7d" + if isinstance(config_data, str) and config_data == update_required_msg: + self.finished.emit(None, "update_required") + return + elif isinstance(config_data, dict) and config_data.get("message") == update_required_msg: self.finished.emit(None, "update_required") return @@ -44,9 +51,15 @@ class ConfigFetchThread(QThread): self.finished.emit(config_data, "") except requests.exceptions.RequestException as e: - self.finished.emit(None, f"网络请求失败: {e}") + error_msg = "访问云端配置失败,请检查网络状况或稍后再试。" + if self.debug_mode: + error_msg += f"\n详细错误: {e}" + self.finished.emit(None, error_msg) except (ValueError, json.JSONDecodeError) as e: - self.finished.emit(None, f"JSON解析失败: {e}") + error_msg = "访问云端配置失败,请检查网络状况或稍后再试。" + if self.debug_mode: + error_msg += f"\nJSON解析失败: {e}" + self.finished.emit(None, error_msg) finally: if self.debug_mode: print("--- Finished fetching cloud config ---") \ No newline at end of file