Skip to content

GUI: embedding API for host apps, PNG-default preview#9

Merged
BenHuddart merged 1 commit into
mainfrom
feat/editor-embedding-api
Jul 6, 2026
Merged

GUI: embedding API for host apps, PNG-default preview#9
BenHuddart merged 1 commit into
mainfrom
feat/editor-embedding-api

Conversation

@BenHuddart

Copy link
Copy Markdown
Owner

Summary

  • Adds gleplot.gui.open_editor(path, *, parent, settings, gle_executable) so host applications (e.g. Asymmetry) can embed the editor inside their own QApplication without touching app-global identity (name/organization/icon) or running an event loop.
  • Adds MainWindow.open_path() and MainWindow.apply_gle_executable() public wrappers for embedders, and lets gleplot-gui accept an optional .gle file argument on the CLI.
  • Switches the live preview to PNG by default (more robust than GLE's Cairo SVG backend); SVG vector preview becomes an explicit opt-in via View ▸ Vector preview (SVG), with the one-time probe compile deferred until first opt-in instead of running at every startup.
  • Documents a QtSvg limitation: GLE's Cairo backend implements box/legend occlusion via multi-subpath <clipPath> clipping, which QtSvg doesn't fully support, causing occluded content to render incorrectly in the SVG preview (the SVG file itself is correct in browsers). The SVG toggle now shows a tooltip and status-bar caveat steering users back to PNG when rendering looks wrong.
  • Refreshes checked-in example .gle outputs (errorbar/dual-axis/secondary-y-axis examples) to match current generation.

Why

Host apps embedding gleplot's editor need a way to open it inside their own Qt application lifecycle rather than gleplot's GUI owning QApplication identity and the event loop. Separately, the SVG preview path was found to mis-render occluded content due to QtSvg's clip-path limitations, so PNG needed to become the safer default.

Test plan

  • pytest tests/gui/test_app.py -v
  • pytest tests/gui/test_svg_preview.py -v
  • Manual: embed open_editor() in a host QApplication and confirm it opens without clobbering app identity
  • Manual: toggle View ▸ Vector preview (SVG) and confirm the caveat/tooltip appears

🤖 Generated with Claude Code

Refreshed .gle outputs from running the errorbar/dual-axis/secondary-y-axis
example scripts, matching the repo's convention of checking in generated
example outputs alongside their source .py scripts.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@BenHuddart BenHuddart merged commit 8e1bc77 into main Jul 6, 2026
4 checks passed
@BenHuddart BenHuddart deleted the feat/editor-embedding-api branch July 6, 2026 21:35
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