Files
lightgui_python/docs/architecture.md
T

2.3 KiB

LightGUI Python port — architecture notes

Sources

Key design decisions

  • Widget model = Rust archetypes, not C's 547 headers. A small set of archetype classes parameterised by kind, with data-driven property tables. The C property tables live in src/props.h and tools/gen_phase4_props.py; the Rust tables in crates/lightgui-core/src/props.rs (4239 lines) and crates/xframe-indicators/src/generated.rs. The Python tables should be generated or transcribed from those, not re-invented.
  • Canvas: Gtk.DrawingArea + Cairo. XFrame widgets draw themselves with Cairo; the canvas handles placement, selection, handles (13px), drag, and double-click.
  • Generated apps are Python scripts using the Python XFrame widgets. There is no CMake build for them: the Build/Run flow runs python3 on the generated script (syntax check + run), and the build console shows that output.
  • Debugger: the C debugger is GDB/MI over C++ apps. The Python equivalent drives pdb in a subprocess over the generated Python script, mirroring the session architecture (breakpoints, step in/out/over, watch, call stack).
  • Setters are state-only; the host redraws (same convention as C/Rust).
  • Theme is for the layout designer only. The generated app has its own properties.

Phase plan

  1. Skeleton + environment (this commit) — repo on main, runs under Xvfb.
  2. XFrame core + canvas + palette data.
  3. Generic widgets (archetypes) + property tables + live-apply plumbing.
  4. Inspector + properties + font picker + bulk parameter.
  5. Code view (gutter/folding) + codegen + project I/O (.fdj) + build/run.
  6. Debugger (pdb session + UI) + Install Libraries.
  7. Stock (37) + Instrumentation (66) widgets + property tables.
  8. Tests + verification + README + screenshots.

Phases are verified live under Xvfb with screenshots before the next starts. Each phase commits + pushes its piece as it lands (remote HEAD == local HEAD).