Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 此拉取请求进行了一次大规模的UI现代化和技术栈升级。通过将UI框架从 Highlights
Changelog
Ignored Files
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
这是一个非常重要的重构,成功地将应用的 UI 从 PyQt-Fluent-Widgets 迁移到了基于 PySide6 和 QML 的新框架 RinUI。代码改动范围很广,几乎触及了所有 UI 和后端逻辑的交互部分。引入一个专门的 Python Backend 类来与 QML 前端交互是一个很好的架构选择,这提高了前后端的分离度。
我主要关注了以下几点:
- 迁移一致性:大部分代码已成功迁移到 PySide6,但仍有部分复杂的对话框(如
CoreManageDialog)使用 Python Widgets 构建,这可能是为了简化迁移过程的有意选择。 - 代码正确性:从 PyQt5 到 PySide6 的转换(如信号/槽语法、移除
Q_ARG)看起来是正确的。 - 后端交互:通过
Backend类和信号机制来更新 UI 是一种良好、解耦的设计。
我提出了一些具体的改进建议,主要集中在状态管理和代码效率上,希望能帮助你进一步提升代码质量。总的来说,这是一次出色的重构工作!
| _current_download_state = { | ||
| 'downloader': None, | ||
| 'is_paused': False, | ||
| 'backend': None, | ||
| 'cancelled': False | ||
| } |
There was a problem hiding this comment.
| def load_ui_file(ui_file_path): | ||
| """ | ||
| 使用 QUiLoader 加载 UI 文件,兼容 PySide6 | ||
|
|
||
| Args: | ||
| ui_file_path (str): UI 文件的路径 | ||
|
|
||
| Returns: | ||
| QWidget: 加载的 UI 对象,如果失败返回 None | ||
| """ | ||
| try: | ||
| loader = QUiLoader() | ||
| # 如果是相对路径,需要转换为绝对路径 | ||
| if not os.path.isabs(ui_file_path): | ||
| script_dir = Path(__file__).parent.parent.absolute() | ||
| ui_file_path = os.path.join(script_dir, ui_file_path) | ||
|
|
||
| if not os.path.exists(ui_file_path): | ||
| log(f"UI 文件不存在: {ui_file_path}", logging.WARNING) | ||
| return None | ||
|
|
||
| with open(ui_file_path, 'r', encoding='utf-8') as f: | ||
| ui = loader.load(f, None) | ||
| return ui | ||
| except Exception as e: | ||
| log(f"加载 UI 文件失败 {ui_file_path}: {e}", logging.ERROR) | ||
| return None | ||
|
|
There was a problem hiding this comment.
load_ui_file 函数在将 UI 文件内容传递给 QUiLoader 之前,会先将整个文件读入内存。loader.load() 方法可以直接接受文件路径字符串作为参数,这样做内存效率更高。
你的规划文档 .trae/documents/plan_20260226_113224.md 中似乎也提到了这个优化点。
def load_ui_file(ui_file_path):
"""
使用 QUiLoader 加载 UI 文件,兼容 PySide6
Args:
ui_file_path (str): UI 文件的路径
Returns:
QWidget: 加载的 UI 对象,如果失败返回 None
"""
try:
loader = QUiLoader()
# 如果是相对路径,需要转换为绝对路径
if not os.path.isabs(ui_file_path):
script_dir = Path(__file__).parent.parent.absolute()
ui_file_path = os.path.join(script_dir, ui_file_path)
if not os.path.exists(ui_file_path):
log(f"UI 文件不存在: {ui_file_path}", logging.WARNING)
return None
# 直接传递文件路径给 loader,而不是先打开文件
ui = loader.load(ui_file_path, None)
return ui
except Exception as e:
log(f"加载 UI 文件失败 {ui_file_path}: {e}", logging.ERROR)
return None|
在https://github.com/BloretCrew/Bloret-Launcher/actions/runs/22615419584 中下载的版本无法打开启动器 Twilight@Timeless:~/下载/Bloret-Launcher-Linux(1)> ./Bloret-Launcher |
|
Important 若要使更改生效,在 RinUI 分支被合并入 Windows 分支之前,请将 Pull Request 发起至 RinUI 分支。 |
添加一些文件夹到linux打包流程
根据Detrialw建议不将BLAPI和BL4CW2打包进去
忘了改nfpm的打包流程了xwx
你这怎么还有cp到zip content的内容(
close #105
To make Bloret Launcher more beautiful and easier to use, replace PyQt-Fluent-Widgets with RinUI.
To get more information, please view ui.rinlit.cn.