Skip to content

Pull in PR #124 and issue features from SumZer0-git/EDAPGui#1

Open
Copilot wants to merge 3 commits into
mainfrom
copilot/pull-pr-and-issues-features
Open

Pull in PR #124 and issue features from SumZer0-git/EDAPGui#1
Copilot wants to merge 3 commits into
mainfrom
copilot/pull-pr-and-issues-features

Conversation

Copy link
Copy Markdown

Copilot AI commented May 12, 2026

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.yml

  • Removed if: false condition — the CI build is now enabled
  • Upgraded Python 3.9 → 3.12
  • Added paddlex[ocr] and paddleocr[all] install steps
  • Added paddlex .version file preparation step
  • Expanded PyInstaller command to collect paddlex, pyclipper, shapely, locales, templates, configs, waypoints
  • Added post-build steps: paddlex dep-check patching, bundle verification, directory fallback copy
  • Changed artifact output from a zip file to a directory

New files: hooks/

  • hook-paddlex.py — PyInstaller hook to collect all paddlex submodules and data
  • patch_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 .version file exists, and sets env flags

Screen.py

  • Added get_resource_path() helper (works for both dev and PyInstaller bundles)
  • Replaced self.mss = mss.mss() with a thread-local mss property (mss 10.x requires per-thread instances)
  • Added crop_offset_x/y and raw_screen_width/height attributes
  • Added _calculate_16_9_crop() — auto-detects and crops to the centered 16:9 area for ultrawide or 4:3 screens
  • Added screen_rect_to_abs_overlay() and abs_rect_to_overlay() — overlay coordinates that include the crop offset
  • Updated write_config/read_config to use get_resource_path() and relative paths

EDWayPoint.py

  • Added get_resource_path() helper
  • Updated all ./waypoints/ file paths to use get_resource_path('waypoints/...')

ED_AP.py

  • Added get_resource_path() helper

simple_localization/localization.py

  • Added get_resource_path() helper
  • Resolves folder_path through get_resource_path() in __init__ for bundle compatibility

configs/resolution.json

  • Fixed indentation whitespace

Issue SumZer0-git#122 / SumZer0-git#43 — Waypoint Repeat Count & Exit After Complete

  • Added WaypointRepeatCount config (default: 0) — number of additional times to repeat the full waypoint route
  • Added WaypointExitAfterComplete config (default: false) — sends ExitToMainMenu key binding after the route finishes
  • Updated waypoint_assist() to loop the route when WaypointRepeatCount > 0, calling mark_all_waypoints_not_complete() between iterations
  • Added WAYPOINT settings block to the Settings tab in the GUI with a spinbox for repeat count and a checkbox for exit-after-complete

Issue SumZer0-git#129 — Safety Hook (Stop if Game Closes)

  • Added SafetyHookEnabled config (default: true)
  • In engine_loop(), checks Screen.elite_window_exists() before each assist cycle; if the window is gone while any assist is active, fires stop_all_assists
  • Added "Stop autopilot if Elite Dangerous closes" checkbox to the AUTOPILOT settings block in the GUI

Notes

  • The ExitToMainMenu feature requires the corresponding key binding to be configured in Elite Dangerous. A graceful error message is shown if the binding is not found.
  • The 16:9 crop support in Screen.py is transparent for standard 16:9 monitors (no offset applied).

Copilot AI requested a review from ap0ught May 12, 2026 22:47
@ap0ught ap0ught marked this pull request as ready for review May 13, 2026 02:36
Copilot AI review requested due to automatic review settings May 13, 2026 02:36
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 switch mss usage 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.

Comment thread hooks/runtime_hook_paddlex.py Outdated
Comment on lines +26 to +45
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)
Comment thread .github/workflows/build-executable.yml Outdated

# 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
Comment thread Screen.py Outdated
"""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)
Comment thread EDWayPoint.py Outdated
Comment on lines +20 to +21
return os.path.join(sys._MEIPASS, relative_path)
return os.path.join(os.path.abspath("."), relative_path)
Comment thread simple_localization/localization.py Outdated
# 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)
Comment thread ED_AP.py Outdated
Comment on lines +15 to +21
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)


Comment thread hooks/hook-paddlex.py Outdated
# 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
@ap0ught
Copy link
Copy Markdown
Owner

ap0ught commented May 13, 2026

@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>
Copy link
Copy Markdown
Author

Copilot AI commented May 13, 2026

@copilot apply changes based on the comments in this thread

All 7 review items addressed in commit 035b9a7:

  • runtime_hook_paddlex.py: Replaced deprecated PEP 302 find_module/load_module with PEP 451-compliant find_spec + create_module/exec_module finder/loader. Also renamed versionPADDLEX_VERSION constant.
  • .github/workflows/build-executable.yml: Fixed the version-update regex from targeting f.write('...') to PADDLEX_VERSION = '...', so the CI step now correctly stamps the real paddlex version into the hook.
  • Screen.py, EDWayPoint.py, simple_localization/localization.py: get_resource_path() now resolves the base directory from os.path.dirname(os.path.abspath(__file__)) instead of os.path.abspath("."), so paths are stable regardless of launch CWD.
  • ED_AP.py: Removed the unused get_resource_path() definition (dead code).
  • hooks/hook-paddlex.py: Removed the unused collect_data_files import.

@ap0ught
Copy link
Copy Markdown
Owner

ap0ught commented May 13, 2026

@copilot apply changes based on the comments in this thread

Copy link
Copy Markdown
Author

Copilot AI commented May 13, 2026

@copilot apply changes based on the comments in this thread

All 7 review items were already addressed in commit 035b9a7 — nothing new to apply. The current branch already has:

  • PEP 451-compliant find_spec/create_module/exec_module hook in runtime_hook_paddlex.py
  • Workflow regex targeting PADDLEX_VERSION = '...'
  • __file__-based paths in Screen.py, EDWayPoint.py, and simple_localization/localization.py
  • Removed dead get_resource_path() from ED_AP.py
  • Removed unused collect_data_files import from hooks/hook-paddlex.py

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.

3 participants