feat: add remote Python TCP server for controlling the app, view, and operations#119
Open
trailcode wants to merge 3 commits into
Open
feat: add remote Python TCP server for controlling the app, view, and operations#119trailcode wants to merge 3 commits into
trailcode wants to merge 3 commits into
Conversation
added 3 commits
June 7, 2026 16:20
…ations - New RemotePythonServer with PythonExecutionQueue for thread-safe execution on main thread (OCCT/GUI safety). - TCP listener (port configurable via --listen [host:]port), accepts Python code snippets, executes in embedded interpreter with existing ezy/view/Shp bindings. - CLI support in main: --listen, --headless (parsed). - Early Python init when server enabled for remote use. - Extended Python bindings (fit_all, screenshot, get_shape, get_camera, set_camera, etc.) and help text. - Added fit_all() to Occt_view. - Reference client script. - Updated agents/dev.md with usage and testing instructions. - Debug prints and error handling for socket issues. - Fixes for build (socket types, const error, etc.). This allows external Python scripts to control the running EzyCad instance (GUI or headless) for automation, remote control, etc. Refs: conversation on dual app+server mode.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements a remote server mode so EzyCad can run as both a desktop GUI application and a controllable server that listens for Python commands to drive the view, sketches, shapes, and operations.
It leverages the existing Python embedding (pybind11 +
ezycad_nativemodule withezy,view,Shpobjects, etc.) but exposes it over the network via a simple TCP REPL.Key Changes
src/python_remote_server.h/.cpp:PythonExecutionQueue(thread-safe task queue) +RemotePythonServer(TCP listener using plain sockets, length-prefixed protocol). Code is queued for safe execution on the main thread (OCCT/ImGui not thread-safe).main.cpp: CLI support (--listen [host:]port,--headlessparsed), early Python force-init when server enabled, integration of queue + server,process_pending()in the main loop.python_console.cpp: Extended Python bindings (e.g.view.fit_all(),view.screenshot(),view.get_shape(), camera get/set) + updated help text mentioning remote use.occt_view.*: Addedfit_all()implementation.scripts/remote_ezy_client.py: Reference client for sending Python code.agents/dev.md: Added detailed usage, launch instructions (important: correct cwd for resources), testing steps, and verification.Usage
The same bindings available in the in-app Python console work remotely. Execution is safe and queued.
Motivation
Enables automation, remote control, external scripting, integration with other tools/web UIs, batch processing, etc., while preserving the full interactive GUI experience.
Status / Testing
agents/dev.mdfor detailed local testing instructions.Closes #118
Next steps / future work
--headlessmode (no GUI window).Ready for review!