Skip to content

Refactor project structure and enhance launcher script functionality - #151

Merged
AbyssRei merged 4 commits into
mainfrom
dev-restructure
Apr 30, 2026
Merged

AbyssRei merged 4 commits into
mainfrom
dev-restructure

Conversation

@AbyssRei

Copy link
Copy Markdown
Collaborator

This pull request contains significant refactoring and improvements to the codebase, focusing on modularization, maintainability, and user experience. The most impactful changes include reorganizing imports to use the new src directory structure, updating resource paths, enhancing the environment selection logic for inference, and improving UI code readability and maintainability.

Project structure and import refactoring:

  • All imports in main.py have been updated to use the new src directory structure, improving code organization and maintainability. For example, modules like loadData, auto_fetch, and recognize are now imported from their respective submodules under src. [1] [2] [3]

Resource path and packaging updates:

  • Resource file paths (icons, backgrounds) in the UI have been updated to reflect the new locations under src/resources/assets, ensuring the application loads assets correctly after restructuring.
  • The PyInstaller build step in the GitHub Actions workflow now runs from src/tools/package.py, and the build artifact path is updated to build/dist/main/.

Inference environment selection improvements:

  • The Windows batch launcher script was renamed and enhanced to allow users to select between multiple inference environments: PyTorch CPU, PyTorch CUDA 12.8, PyTorch CUDA 13.0, or ONNX Runtime. The logic now uses uv sync to install dependencies according to the user's selection, improving flexibility and user experience.

UI code improvements:

  • UI code in main.py has been refactored for readability, including breaking up long import lines, reformatting style sheet strings, and improving alignment and clarity of widget setup and signal connections. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16]

Other enhancements:

  • Improved error handling, initialization logic, and comments throughout the UI logic, making the codebase more robust and easier to maintain. [1] [2]

These changes collectively modernize the codebase, streamline development, and enhance the user and developer experience.

AbyssRei and others added 4 commits May 1, 2026 03:08
Co-authored-by: Copilot <copilot@github.com>
This pull request introduces improvements to both the user experience and code logic in the launcher batch script and the auto-fetch module. The batch script now provides more flexible inference environment options for users, while the auto-fetch logic is refined to prevent unintentional overwriting of prediction results.

Launcher script enhancements:

Expanded the inference environment selection in iron_shark_launcher.bat to allow users to choose between PyTorch CPU, CUDA 12.8, CUDA 13.0, or onnxruntime, with improved prompt text and logic for handling user input.
Updated the script to use uv sync with the appropriate --extra flag based on the user's choice, rather than always attempting to install PyTorch, and clarified messages to the user.
Auto-fetch logic improvement:

In src/game/auto_fetch.py, changed the heartbeat update to use the current prediction value instead of a fixed 0, preventing accidental overwriting of GUI prediction results.
* refactor: 优化uv安装和推理环境选择逻辑

Co-authored-by: Copilot <copilot@github.com>

* fix(auto_fetch): 刷新当前预测显示,避免覆盖 GUI 错误

* fix(sim): 修复路径问题

* feat(paths): 添加路径管理模块,统一资源路径管理
- 新增 paths.py 文件,定义项目根目录、资源目录、数据目录等路径
- 更新多个模块以使用新的路径管理函数,确保路径的一致性和可维护性

Co-authored-by: Copilot <copilot@github.com>

---------

Co-authored-by: Copilot <copilot@github.com>
@AbyssRei
AbyssRei merged commit 8c1a922 into main Apr 30, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant