refactor(automation): drop screenshot.viewport3d, keep only screenshot.window

The on-screen window capture is composited from the desktop framebuffer, so it
already includes the GL 3D viewport as currently shown (model in the editor,
toolpaths in Preview). The offscreen render_thumbnail path only ever drew the
model GLVolumeCollection — never the gcode toolpaths — and produced a blank image
after slicing because the app switches to the Preview panel. Rather than maintain a
second, more limited capture method, remove it entirely.

Removes the JSON-RPC method, IUiBackend/WxUiBackend implementation, dispatcher
route + capability entry, the now-dead opt_int/thumbnail_to_wximage helpers and
ThumbnailData include, the mock override + unit test, and the Python
screenshot_3d client method. Docs updated accordingly.
This commit is contained in:
SoftFever
2026-06-03 18:05:23 +08:00
parent 952696fd1f
commit 892b33bac5
10 changed files with 25 additions and 129 deletions

View File

@@ -1,5 +1,5 @@
"""End-to-end smoke test: launch OrcaSlicer with the automation server, load a
model, slice it, wait for completion, and save both a window PNG and a 3D PNG.
model, slice it, wait for completion, and save a window PNG.
Run:
python example_slice.py --orca /path/to/OrcaSlicer --model /path/to/cube.stl
@@ -56,11 +56,12 @@ def main() -> int:
orca.wait_for({"id": "btn_export"}, state="enabled", timeout_ms=180000,
poll_ms=500)
# The window screenshot is captured from the on-screen composited
# framebuffer, so it already includes the 3D viewport (model in the
# editor, or toolpaths in Preview after slicing).
with open("window.png", "wb") as f:
f.write(orca.screenshot())
with open("preview_3d.png", "wb") as f:
f.write(orca.screenshot_3d(width=1920, height=1080))
print("wrote window.png and preview_3d.png")
print("wrote window.png")
return 0
finally:
proc.terminate()

View File

@@ -6,8 +6,8 @@ Usage:
print(orca.version())
orca.click({"id": "btn_slice"})
orca.wait_for({"id": "btn_export"}, state="enabled", timeout_ms=120000)
png = orca.screenshot_3d(width=1024, height=768)
open("preview.png", "wb").write(png)
png = orca.screenshot()
open("window.png", "wb").write(png)
"""
from __future__ import annotations
import base64
@@ -94,18 +94,8 @@ class OrcaClient:
return self._call("app.state")
def screenshot(self, target: Optional[dict] = None) -> bytes:
"""Capture a window as a PNG, exactly as composited on screen (includes the
GL 3D viewport and ImGui overlays). Defaults to the main frame."""
params = {"target": target} if target is not None else None
result = self._call("screenshot.window", params)
return base64.b64decode(result["png_base64"])
def screenshot_3d(self, plate: Optional[int] = None,
width: Optional[int] = None, height: Optional[int] = None) -> bytes:
params: dict = {}
if plate is not None:
params["plate"] = plate
if width is not None:
params["width"] = width
if height is not None:
params["height"] = height
result = self._call("screenshot.viewport3d", params or None)
return base64.b64decode(result["png_base64"])