# LightGUI Python port — architecture notes ## Sources - C designer (canonical behaviour): /opt/lightgui, https://github.com/cnmcdee/lightgui - Rust designer (structural reference): /opt/lightgui_rust, https://github.com/cnmcdee/lightgui_rust - Property model: /root/lightgui-inspector-properties.md on the server (Lazarus RTTI audit; generic set + per-widget custom props + 13 §4 flag decisions) ## 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 0. Skeleton + environment (this commit) — repo on `main`, runs under Xvfb. 1. XFrame core + canvas + palette data. 2. Generic widgets (archetypes) + property tables + live-apply plumbing. 3. Inspector + properties + font picker + bulk parameter. 4. Code view (gutter/folding) + codegen + project I/O (.fdj) + build/run. 5. Debugger (pdb session + UI) + Install Libraries. 6. Stock (37) + Instrumentation (66) widgets + property tables. 7. 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).