Pull in PR #124 and issue features from SumZer0-git/EDAPGui#1
Conversation
…0-git#122/SumZer0-git#43/SumZer0-git#129) Agent-Logs-Url: https://github.com/ap0ught/EDAPGui/sessions/12760688-8073-49b9-8adb-487def342ada Co-authored-by: ap0ught <41078+ap0ught@users.noreply.github.com>
Agent-Logs-Url: https://github.com/ap0ught/EDAPGui/sessions/12760688-8073-49b9-8adb-487def342ada Co-authored-by: ap0ught <41078+ap0ught@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR pulls in upstream changes to support Python 3.12 + PyInstaller builds (including PaddleX/PaddleOCR bundling) and adds new autopilot features requested in issues (waypoint repeat/exit behavior and a safety hook to stop assists if the game closes). It also improves runtime behavior for non-16:9 displays and for mss thread usage.
Changes:
- Enable/expand the Windows CI workflow to build a PyInstaller onedir bundle on Python 3.12, including PaddleX hooks and post-build patching.
- Add 16:9 crop support + overlay coordinate helpers in
Screen.py, and switchmssusage to per-thread instances. - Add waypoint route repeat/exit-after-complete config + GUI controls, and add a safety hook that stops assists when the ED window disappears.
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
simple_localization/localization.py |
Adds a bundle-aware resource path helper and applies it to localization folder resolution. |
Screen.py |
Adds resource path helper, thread-local mss, 16:9 crop calculations, and overlay coordinate conversion helpers. |
hooks/runtime_hook_paddlex.py |
New PyInstaller runtime hook to disable PaddleX dependency checks and ensure .version exists. |
hooks/patch_paddlex_bundle.py |
New post-build script to patch PaddleX dependency checks inside the built bundle. |
hooks/hook-paddlex.py |
New PyInstaller hook to collect PaddleX modules/data for freezing. |
EDWayPoint.py |
Moves waypoint file IO to bundle-aware paths and adds repeat + exit-after-complete logic. |
EDAPGui.py |
Adds GUI settings for waypoint repeat/exit and the safety hook toggle. |
ED_AP.py |
Adds new config defaults and a safety hook check in the engine loop. |
configs/resolution.json |
Formatting/indentation cleanup. |
.github/workflows/build-executable.yml |
Enables and significantly expands the Windows build pipeline for PyInstaller + PaddleX. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| class PaddlexDepsImportHook: | ||
| """ | ||
| Import hook that patches paddlex.utils.deps after it loads. | ||
| """ | ||
| _patched = False | ||
|
|
||
| def find_module(self, fullname, path=None): | ||
| # Intercept paddlex.utils.deps import | ||
| if fullname == 'paddlex.utils.deps' and not self._patched: | ||
| return self | ||
| return None | ||
|
|
||
| def load_module(self, fullname): | ||
| # If already in sys.modules and patched, return it | ||
| if fullname in sys.modules and self._patched: | ||
| return sys.modules[fullname] | ||
|
|
||
| # Remove this finder temporarily to allow normal import | ||
| if self in sys.meta_path: | ||
| sys.meta_path.remove(self) |
|
|
||
| # Update the runtime hook with the actual version | ||
| $hookFile = "hooks\runtime_hook_paddlex.py" | ||
| (Get-Content $hookFile) -replace "f\.write\('.*'\)", "f.write('$version')" | Set-Content $hookFile |
| """Get absolute path to resource, works for dev and PyInstaller bundles.""" | ||
| if hasattr(sys, '_MEIPASS'): | ||
| return os.path.join(sys._MEIPASS, relative_path) | ||
| return os.path.join(os.path.abspath("."), relative_path) |
| return os.path.join(sys._MEIPASS, relative_path) | ||
| return os.path.join(os.path.abspath("."), relative_path) |
| # Running as PyInstaller bundle | ||
| return os.path.join(sys._MEIPASS, relative_path) | ||
| # Running as normal Python script | ||
| return os.path.join(os.path.abspath("."), relative_path) |
| def get_resource_path(relative_path: str) -> str: | ||
| """Get absolute path to resource, works for dev and PyInstaller bundles.""" | ||
| if hasattr(sys, '_MEIPASS'): | ||
| return os.path.join(sys._MEIPASS, relative_path) | ||
| return os.path.join(os.path.abspath("."), relative_path) | ||
|
|
||
|
|
| # PyInstaller hook for paddlex | ||
| # This ensures all paddlex dependencies and data files are collected | ||
|
|
||
| from PyInstaller.utils.hooks import collect_all, collect_submodules, collect_data_files |
|
@copilot apply changes based on the comments in this thread |
…ased paths, remove dead code Agent-Logs-Url: https://github.com/ap0ught/EDAPGui/sessions/f46f5f5a-1330-45b9-a763-18b5713a4440 Co-authored-by: ap0ught <41078+ap0ught@users.noreply.github.com>
All 7 review items addressed in commit
|
|
@copilot apply changes based on the comments in this thread |
All 7 review items were already addressed in commit
|
Summary
This PR integrates changes from SumZer0-git/EDAPGui PR #124 and implements features requested in open issues.
Changes
PR SumZer0-git#124 — Python 3.12 + PyInstaller/PaddleX Build Support
.github/workflows/build-executable.ymlif: falsecondition — the CI build is now enabledpaddlex[ocr]andpaddleocr[all]install steps.versionfile preparation stepNew files:
hooks/hook-paddlex.py— PyInstaller hook to collect all paddlex submodules and datapatch_paddlex_bundle.py— Post-build script to patch paddlex dependency checks in the bundle (disables runtime dep checks that fail in frozen apps)runtime_hook_paddlex.py— Runtime hook that installs an import hook to silence paddlex.utils.deps checks, ensures the paddlex.versionfile exists, and sets env flagsScreen.pyget_resource_path()helper (works for both dev and PyInstaller bundles)self.mss = mss.mss()with a thread-localmssproperty (mss 10.x requires per-thread instances)crop_offset_x/yandraw_screen_width/heightattributes_calculate_16_9_crop()— auto-detects and crops to the centered 16:9 area for ultrawide or 4:3 screensscreen_rect_to_abs_overlay()andabs_rect_to_overlay()— overlay coordinates that include the crop offsetwrite_config/read_configto useget_resource_path()and relative pathsEDWayPoint.pyget_resource_path()helper./waypoints/file paths to useget_resource_path('waypoints/...')ED_AP.pyget_resource_path()helpersimple_localization/localization.pyget_resource_path()helperfolder_paththroughget_resource_path()in__init__for bundle compatibilityconfigs/resolution.jsonIssue SumZer0-git#122 / SumZer0-git#43 — Waypoint Repeat Count & Exit After Complete
WaypointRepeatCountconfig (default:0) — number of additional times to repeat the full waypoint routeWaypointExitAfterCompleteconfig (default:false) — sendsExitToMainMenukey binding after the route finisheswaypoint_assist()to loop the route whenWaypointRepeatCount > 0, callingmark_all_waypoints_not_complete()between iterationsIssue SumZer0-git#129 — Safety Hook (Stop if Game Closes)
SafetyHookEnabledconfig (default:true)engine_loop(), checksScreen.elite_window_exists()before each assist cycle; if the window is gone while any assist is active, firesstop_all_assistsNotes
ExitToMainMenufeature requires the corresponding key binding to be configured in Elite Dangerous. A graceful error message is shown if the binding is not found.