Step 5: cut .fdj to XFrame-only, drop the GTK palette (547 XFrame entries)
Palette is XFrame-only: the 36 GTK widgets are gone from designer.ui and main.cpp (547 entries from xframe_palette.h). .fdj holds only XFrame widgets; on load a GTK/unknown type is skipped with a clear message, never migrated. snapshot/load now go through the embedded XFrame canvas; the GTK Item machinery stays only as selftest scaffolding (legacy_gtk_snapshot) until it is removed in a follow-up. Selftest phases 3-8 rewritten for the step-4 XFrame generator (4 files, lg::Holder markers, file-level + XFrame round-trips, GTK skip rule, bad-file rejection). Palette/converter tests updated to 547; xframe_palette.h regenerated (one stale comment line). Docs updated. Also: selftest cleans scratch generation dirs first, and the cleanup call assigns its return value (void cast does not silence -Wunused-result for system() on this toolchain).
This commit is contained in:
1 parent
54e31d9c45
commit
c31b4b6a8b
14 files changed
+659
-1215
No files matched your search
@@ -45,10 +45,10 @@ No Qt anywhere.
|
||||
- **547 XFrame widgets** — a second widget library of hand-drawn X11
|
||||
widgets in 11 sections (Gtk*, T*, Ind*, Stock*, Inst*, plus XGraph and
|
||||
XSpreadsheet), each with its own demo, all merged into the same IDE.
|
||||
- **Combined palette** — 583 entries (36 designer widgets + 547 XFrame
|
||||
widgets) with 16×16 icons, a layout window that places any of them,
|
||||
and a seam converter (`layout_to_lightgui.py`) that turns an XFrame
|
||||
layout into a LightGUI project.
|
||||
- **XFrame-only palette** — 547 entries (all XFrame widgets) with
|
||||
16×16 icons; the embedded canvas places the real widget class for
|
||||
any of them. A seam converter (`layout_to_lightgui.py`) turns an
|
||||
XFrame layout file into a LightGUI project (`.fdj`, XFrame-only).
|
||||
- **Project files** — JSON (`.fdj`), replacing the original's Python
|
||||
pickle format.
|
||||
|
||||
@@ -171,18 +171,13 @@ There are **two launch points**, and they are not the same thing:
|
||||
|
||||
| Command | What it is | What you get |
|
||||
| ------- | ---------- | ------------ |
|
||||
| `./ide` | A launcher script (a small shell script, not a binary) | The **full IDE** — six windows: the designer (canvas, 36-widget palette, Object Inspector, Code view) **plus** the XFrame palette (547 widgets) and the XFrame layout window. This is the one to run for normal use. |
|
||||
| `./lightgui` | The compiled designer binary | The **designer alone** — four windows, no XFrame palette and no XFrame layout window. |
|
||||
| `./ide` | A launcher script (a small shell script, not a binary) | The **designer** (single process): designer window with the embedded XFrame canvas, the XFrame-only palette window (547 widgets), Object Inspector, Code view. This is the one to run for normal use. |
|
||||
| `./lightgui` | The compiled designer binary | The **designer alone**, run directly (same windows; `./ide` just builds first if asked). |
|
||||
|
||||
`./ide` starts three processes — the XFrame palette, the XFrame layout
|
||||
window, and the designer — and cleans the first two up when the designer
|
||||
exits. `./ide --build` rebuilds both halves first; `./ide --no-xframe`
|
||||
skips the XFrame windows (the same as running `./lightgui`).
|
||||
|
||||
**XFrame widgets need `./ide`.** The XFrame layout window is a separate
|
||||
process: if it is not running, there is nothing for an XFrame widget to
|
||||
place into. So run `./ide`, not `./lightgui`, when you want to place
|
||||
XFrame widgets.
|
||||
`./ide` is a single-process launcher now (step 6): it builds first
|
||||
only with `--build`, then execs `./lightgui`. The standalone XFrame
|
||||
palette/layout processes are gone — the canvas is embedded in the
|
||||
designer and the palette is its own window inside the same process.
|
||||
|
||||
`make` builds the `lightgui` designer and all 547 XFrame widget demos
|
||||
(`make lightgui` builds just the designer, `make widgets` just the
|
||||
@@ -245,9 +240,9 @@ make test
|
||||
./tests/code_window_tests.sh
|
||||
```
|
||||
|
||||
The combined palette self-test covers all 583 entries (36 designer +
|
||||
547 XFrame); the debugger suite is 46 checks; the seam test maps 136 of
|
||||
the 547 widgets directly and verifies the rest pass through unmapped.
|
||||
The palette self-test covers all 547 XFrame entries; the debugger
|
||||
suite is 46 checks; the seam test maps all 547 widgets and verifies
|
||||
the generated project builds.
|
||||
|
||||
## Layout of the repo
|
||||
|
||||
|
||||
+55
-90
@@ -43,27 +43,19 @@ its View-menu entry brings it back.
|
||||
|---|---|---|---|
|
||||
| Designer | `LightGUI — C++/GTK — <name>` | 1150x720 | Canvas, Events pane, menus (properties live in the Object Inspector window) |
|
||||
| Object Inspector | `LightGUI — Object Inspector` | 300x700 | Property editor in its own top-level window, separate from the layout window |
|
||||
| Widget palette | `LightGUI — Widgets` | 250x780 | **Combined palette, 583 entries**: the 36 LightGUI buttons in grouped sections (the original Tk set plus 20 Lazarus-style widgets), 2px grid spacing, 20px buttons — Lazarus palette density — then all 547 XFrame widgets in their 11 section groups, each with its 16x16 icon; the window scrolls |
|
||||
| Widget palette | `LightGUI — Widgets` | 250x780 | **XFrame-only palette, 547 entries**: all 547 XFrame widgets in their 11 section groups, each with its 16x16 icon; the window scrolls |
|
||||
| Code | `LightGUI — Code` | 1000x700 | Generated C++ with gutter, folding, themes, breakpoints, automatic variable inspection |
|
||||
| Debugger | `LightGUI Debugger` | — | GDB/MI stepping debugger (Debug → Open Debugger…) |
|
||||
| XFrame palette | `LightGUI Palette - 547 widgets` | 380x880 | All 547 XFrame widgets in 11 collapsible sections, each with its 16x16 icon (`lightgui_palette`) |
|
||||
| XFrame layout | `LightGUI Layout` | 1024x720 | Live XFrame design surface: place, move, resize real widget instances (`lightgui_layout`) |
|
||||
|
||||
The **combined palette** (`LightGUI — Widgets`) holds both sets:
|
||||
the 36 LightGUI entries place widgets onto the GTK canvas (those
|
||||
become generated C++/GTK code); the 547 XFrame entries select an
|
||||
XFrame widget and hand the choice to the **layout window** via the
|
||||
shared selection file (`/tmp/lightgui-selection.txt`), exactly as the
|
||||
standalone palette does. The layout window instantiates the *real*
|
||||
XFrame widget class and lets you place, move, and resize it live.
|
||||
|
||||
There is also a **standalone XFrame palette**
|
||||
(`lightgui_palette`, `LightGUI Palette - 547 widgets`): the same 547
|
||||
widgets in 11 collapsible sections, writing the same selection file.
|
||||
Either palette can drive the layout window. The layout window is
|
||||
the XFrame design surface; it saves a layout text file, it does not
|
||||
emit LightGUI projects — the seam in section 2 below is how a saved
|
||||
layout reaches the designer.
|
||||
The **palette** (`LightGUI — Widgets`) is XFrame-only since step 5
|
||||
(Nov 29, 2026): 547 entries in 11 section groups. Clicking an entry
|
||||
selects that XFrame widget in-process; clicking the embedded canvas
|
||||
places the *real* XFrame widget class, and it can be moved, resized
|
||||
(double-click for handles), and deleted there. There is no separate
|
||||
palette process and no selection file anymore, and the standalone
|
||||
layout window is deleted (step 6) — the canvas lives inside the
|
||||
designer. `widgets/palette/` (`lightgui_palette`) is still in the
|
||||
tree but is dead code: `./ide` no longer launches it.
|
||||
|
||||
## Build
|
||||
|
||||
@@ -76,7 +68,7 @@ display — a real X server or Xvfb (see
|
||||
**Combined build:** a top-level `Makefile` builds both halves:
|
||||
|
||||
```sh
|
||||
make # designer + widgets (547 demos + palette + layout)
|
||||
make # designer + widgets (547 demos + palette)
|
||||
make lightgui # designer/lightgui only
|
||||
make widgets # widgets/build only
|
||||
make test # seam test: layout -> .fdj -> codegen -> CMake build
|
||||
@@ -96,8 +88,8 @@ cmake -S . -B build
|
||||
cmake --build build -j"$(nproc)" # all 547 demos, 0 errors, 0 warnings (-Wall -Wextra)
|
||||
```
|
||||
|
||||
Binaries: `lightgui`, `widgets/build/palette/lightgui_palette`,
|
||||
`widgets/build/layout/lightgui_layout`,
|
||||
Binaries: `lightgui`, `widgets/build/palette/lightgui_palette`
|
||||
(dead code — no longer launched),
|
||||
`widgets/build/components/<Name>/<Name>`.
|
||||
|
||||
A single component builds standalone — copy its directory out and
|
||||
@@ -107,30 +99,22 @@ run `cmake -S . -B build` in it; each component ships its own copy of
|
||||
|
||||
## Launch
|
||||
|
||||
**Single launcher:** `./ide` at the repo root starts the IDE. It
|
||||
builds anything missing first (`--build` forces a rebuild), then
|
||||
starts the designer, the XFrame palette and the XFrame layout window
|
||||
as separate top-level windows on the same X display; closing the
|
||||
designer ends the session (the palette/layout windows go with it).
|
||||
`./ide --no-xframe` starts the designer alone. All three programs
|
||||
must share one display — run under Xvfb if there is no real X server.
|
||||
**Single launcher:** `./ide` at the repo root starts the designer
|
||||
(single process). It builds anything missing first (`--build` forces
|
||||
a rebuild), then execs `./lightgui`. Run under Xvfb if there is no
|
||||
real X server.
|
||||
|
||||
**Launching each half today:**
|
||||
|
||||
```sh
|
||||
./lightgui # designer + palette + inspector + code windows together
|
||||
./widgets/build/palette/lightgui_palette # XFrame palette (same X display)
|
||||
./widgets/build/layout/lightgui_layout # XFrame layout window
|
||||
```
|
||||
|
||||
All three XFrame programs and the designer must share one X display.
|
||||
Under Xvfb:
|
||||
The designer is a single process. Under Xvfb:
|
||||
|
||||
```sh
|
||||
Xvfb :99 -screen 0 1920x1080x24 &
|
||||
DISPLAY=:99 ./lightgui
|
||||
DISPLAY=:99 ./widgets/build/palette/lightgui_palette &
|
||||
DISPLAY=:99 ./widgets/build/layout/lightgui_layout &
|
||||
```
|
||||
|
||||
## End-to-end workflow
|
||||
@@ -163,26 +147,18 @@ Save the design as a JSON project file (`.fdj`).
|
||||
|
||||
### 2. Place XFrame widgets (palette + layout)
|
||||
|
||||
Pick the widget in either palette. In the **combined palette**
|
||||
(`LightGUI — Widgets`), scroll down past the LightGUI buttons to
|
||||
the XFrame section groups and click an entry — its 16x16 icon and
|
||||
name are shown, and the choice is written to
|
||||
`/tmp/lightgui-selection.txt` for the layout window. In the
|
||||
standalone XFrame palette, click a section header to collapse/expand
|
||||
it, scroll with the wheel or keyboard, and click (or Up/Down + Enter)
|
||||
to select a widget — the title bar shows the selection, and the
|
||||
choice is written to the same file. In the layout window,
|
||||
click empty canvas to place the selected widget at its default size,
|
||||
drag a placed widget to move it, Delete to remove it. Double-click a
|
||||
placed widget for 8 orange resize handles (corners + edges); drag a
|
||||
handle to resize live; Escape dismisses the handles, `s` saves the
|
||||
layout to `/tmp/lightgui-layout.txt`, `q` quits. The layout window
|
||||
re-reads the selection file every 100 ms, so picking in the palette
|
||||
updates the "selected to place" readout in its status bar.
|
||||
Pick the widget in the palette (`LightGUI — Widgets`): scroll to
|
||||
the XFrame section group and click an entry — its 16x16 icon and name
|
||||
are shown. Click empty canvas in the designer to place the real
|
||||
XFrame widget class at its default size, drag a placed widget to move
|
||||
it, Delete to remove it. Double-click a placed widget for resize
|
||||
handles; drag a handle to resize live; Escape dismisses the handles.
|
||||
Save the design with File → Save project (`.fdj`, XFrame-only) and
|
||||
reopen it with File → Open project.
|
||||
|
||||
**From layout to designer (the seam):** the layout is not a dead end.
|
||||
Save it (`s`, or `SAVE` in a script) and convert it to an LightGUI
|
||||
project:
|
||||
**From layout file to designer (the seam):** a layout text file (one
|
||||
`<XFrameName> <x> <y> <width> <height>` per line, as the old layout
|
||||
window saved) converts to a LightGUI project:
|
||||
|
||||
```sh
|
||||
python3 widgets/tools/layout_to_lightgui.py /tmp/lightgui-layout.txt /tmp/layout.fdj
|
||||
@@ -190,46 +166,35 @@ python3 widgets/tools/layout_to_lightgui.py /tmp/lightgui-layout.txt /tmp/layout
|
||||
|
||||
Open `/tmp/layout.fdj` in the designer (**File → Open project**) and
|
||||
continue with section 3 (generate) and section 5 (debug) below.
|
||||
136 of the 547 XFrame widgets map to a real GTK counterpart (35 are
|
||||
nearest-match approximations, listed by the converter); 411 — the 58
|
||||
original XFrame-only widgets (dialogs, choosers, menus) plus all 287 Stock
|
||||
Market widgets plus all 66 Instrumentation widgets — have no designer
|
||||
equivalent and are reported, never forced into a wrong type.
|
||||
The generated app re-creates the widgets as GTK widgets: it does not
|
||||
link XFrame classes, and layout edits do not flow back into the
|
||||
designer — re-run the converter. Proved end to end by
|
||||
All 547 XFrame widgets map straight through — the .fdj carries the
|
||||
XFrame class name as the widget type, and the generated app
|
||||
instantiates the XFrame classes directly. Names that are not in the
|
||||
registry are reported and skipped, never forced into a wrong type.
|
||||
Proved end to end by
|
||||
`widgets/tests/test_layout_to_lightgui.py` (`make test`).
|
||||
|
||||
The layout tool also has a script mode for automated testing:
|
||||
`lightgui_layout --script cmds.txt --log out.log` with `PLACE`,
|
||||
`PLACE_ALL`, `MOVE`, `RESIZE`, `DELETE`, `SELECT`, `DBLCLICK`,
|
||||
`HANDLE`, `CHECKDRAW`, `SAVE` / `LOAD`, `LIST`, `COUNT`, `QUIT`.
|
||||
|
||||
### 3. Generate code (designer)
|
||||
|
||||
**File → Generate C++/GTK…** asks for a folder and writes a complete
|
||||
project. The output is **all code — no `.ui` file** — so a stepping
|
||||
debugger can walk widget construction line by line, and every widget
|
||||
is a **standalone class in its own `.h`/`.cpp` pair**: creation plus
|
||||
configuration in the constructor, the same nine mouse-event stub
|
||||
handlers per widget (`buttonPress1-3`, `dblbuttonPress1-3`,
|
||||
`buttonRelease1-3`) routed by two dispatchers, and a
|
||||
`util_error_print` helper. The window class just instantiates one
|
||||
widget class per designed widget. Regions in the generated code are
|
||||
marked `// #region`, which the code view folds.
|
||||
project (step 4, Nov 29, 2026). The output is a plain X11/XFrame
|
||||
program — **no GTK, no `.ui` file** — in a single `main.cpp`: it opens
|
||||
the display, creates the top-level window, sets up the
|
||||
`SStyle_Manager`, constructs one `lg::Holder<T>` per placed widget
|
||||
(T is the XFrame class), applies properties through the widgets'
|
||||
getter/setter API, wires connected signals to stub handlers that
|
||||
print `EVENT <Widget> <signal>`, and runs an X event loop dispatching
|
||||
through `lg::IWidget`.
|
||||
|
||||
Every generated project also gets a `CMakeLists.txt` next to its
|
||||
`Makefile` (`cmake_minimum_required(VERSION 3.10)`,
|
||||
`project(<ClassName> CXX)`, C++17, `find_package(PkgConfig)` /
|
||||
`pkg_check_modules(GTK3 REQUIRED gtk+-3.0)`, every generated `.cpp`
|
||||
listed explicitly in `add_executable(app …)`). The executable is
|
||||
named `app`, matching the Makefile target, and builds standalone
|
||||
with:
|
||||
`Makefile` (`cmake_minimum_required(VERSION 3.20)`,
|
||||
`project(<ClassName> CXX)`, C++17, `find_package(X11 REQUIRED)`,
|
||||
`add_executable(app main.cpp)`). The executable is named `app`,
|
||||
matching the Makefile target, and builds with:
|
||||
|
||||
```sh
|
||||
g++ -o app *.cpp $(pkg-config --cflags --libs gtk+-3.0)
|
||||
# or
|
||||
cmake -S . -B build && cmake --build build
|
||||
# or
|
||||
make
|
||||
```
|
||||
|
||||
From the designer, **File → Generate C++/GTK…** offers **Build with
|
||||
@@ -393,10 +358,10 @@ draw 547/547, all 547 alive at once. Full tables:
|
||||
`widgets/test-results/palette_layout_results.csv`.
|
||||
|
||||
Designer test status (Nov 29, 2026 tree): `make clean && make`, zero
|
||||
warnings; combined palette self-test 583/583 (36 designer + 547 XFrame);
|
||||
warnings; palette self-test 547/547 (XFrame-only);
|
||||
debugger suite 46/46; widget tests pass; code-window suite all pass;
|
||||
palette-window tests 16/16; palette-icons tests 13/13; seam test
|
||||
(`make test`) ALL PASS — 136 mapped, 411 unmapped; placement test
|
||||
(`make test`) ALL PASS — 547 mapped, 0 unmapped; placement test
|
||||
547/547 place, 547/547 draw.
|
||||
|
||||
## Repo layout
|
||||
@@ -416,8 +381,7 @@ palette-window tests 16/16; palette-icons tests 13/13; seam test
|
||||
├── widgets/ # XFrame library (547 widgets)
|
||||
│ ├── components/<Name>/ # <Name>.h + main_<Name>.cpp + CMakeLists.txt
|
||||
│ ├── core/xframe_core.h # canonical shared core
|
||||
│ ├── palette/ # lightgui_palette
|
||||
│ ├── layout/ # lightgui_layout
|
||||
│ ├── palette/ # lightgui_palette (dead code, step 6)
|
||||
│ ├── common/ # registry.h, ipc.h, ico.h
|
||||
│ ├── icons/ # 547 real 16x16 .ico icons
|
||||
│ ├── tools/ # docgen, gen_icons.py, gen_registry.py, sections.py
|
||||
@@ -483,11 +447,12 @@ of Nov 29, 2026, combined IDE in this repo):
|
||||
|
||||
Verified in the integration pass (VPS, Nov 29, 2026): the top-level
|
||||
build, the `./ide` launcher, the repo-root + `widgets/` split paths
|
||||
used above, the combined 583-entry palette
|
||||
used above, the XFrame-only 547-entry palette
|
||||
(`src/xframe_palette.h`, generated by
|
||||
`widgets/tools/gen_xframe_palette_data.py`, covered by
|
||||
`widgets/tests/test_combined_palette.py`: presence 36+547 exact,
|
||||
self-test 583/583, real-mouse place of GtkAboutDialog), and the
|
||||
`widgets/tests/test_combined_palette.py`: presence 547 exact,
|
||||
self-test 547/547, real-mouse place of GtkAboutDialog in the embedded
|
||||
canvas), and the
|
||||
layout → designer seam (`widgets/tools/layout_to_lightgui.py`,
|
||||
covered by `widgets/tests/test_layout_to_lightgui.py`).
|
||||
Combined-IDE test results are in the repo README and in the
|
||||
|
||||
+10
-11
@@ -230,17 +230,16 @@ README).
|
||||
|
||||
- **Selector palette** — `palette/` builds `lightgui_palette` (part of the
|
||||
top-level build). A pure X11/XFrame window listing all 547 widgets in
|
||||
their 11 sections, each with its 16x16 icon. Click (or Up/Down + Enter)
|
||||
to select; the selection is written to the shared selection file
|
||||
(`/tmp/lightgui-selection.txt`) for the layout tool. Self-test:
|
||||
547/547 selections OK.
|
||||
- **Layout window** — `layout/` builds `lightgui_layout`. Instantiates the
|
||||
real widget classes via the generated factory in `common/registry.h`
|
||||
(generated by `tools/gen_registry.py` — do not edit by hand). Click to
|
||||
place the selected widget, drag to move, Delete to remove, `s` to
|
||||
save/load the layout, `q` to quit. Double-click a placed widget for 8
|
||||
orange resize handles (corners + edges); drag a handle to resize live;
|
||||
Escape dismisses the handles, Delete removes the widget.
|
||||
their 11 sections, each with its 16x16 icon. NOTE (step 6, Nov 29,
|
||||
2026): this standalone palette is dead code — `./ide` no longer
|
||||
launches it. The palette now lives inside the designer as its own
|
||||
window, and selection is in-process: click an entry, then click the
|
||||
embedded canvas to place the real widget class.
|
||||
- **Layout window** — DELETED (step 6, Nov 29, 2026). The design
|
||||
surface is now the XFrame-native canvas embedded in the designer:
|
||||
click to place the selected widget, drag to move, Delete to remove.
|
||||
Double-click a placed widget for resize handles; drag a handle to
|
||||
resize live; Escape dismisses the handles, Delete removes the widget.
|
||||
- **Icons** — `icons/<Name>.ico`, one real 16x16 ICO per widget,
|
||||
purpose-drawn glyphs generated by `tools/gen_icons.py` (70 glyph kinds,
|
||||
section accent colours — not downscaled screenshots). Verified by
|
||||
|
||||
@@ -3,8 +3,9 @@
|
||||
The 11th XFrame palette section (amber accent): 66 widgets — tank levels,
|
||||
switches, illuminators and status LEDs, gauges, panel furniture, LED digit
|
||||
displays, analog needles, and higher-segment alphanumeric displays — taking
|
||||
the library from 481 to 547 widgets in 11 sections and the combined IDE
|
||||
palette from 517 to 583 entries (36 LightGUI + 547 XFrame). Every widget
|
||||
the library from 481 to 547 widgets in 11 sections; the IDE
|
||||
palette is XFrame-only, 547 entries (the 36 GTK entries were removed
|
||||
in step 5, Nov 29, 2026). Every widget
|
||||
is a header-only X11 class in `widgets/components/<Name>/`, following the
|
||||
`XGraph` pattern (`Display*`/screen/window/GC, `draw()`, `on_button_press`,
|
||||
`on_button_release`, `on_motion`, `on_key`), in the standard XFrame
|
||||
@@ -113,13 +114,13 @@ derived from the registry at run time, never hard-coded.
|
||||
| --- | --- |
|
||||
| Section assignment (`tools/sections.py`) | 547 widgets, exactly one section each; Instrumentation 66 |
|
||||
| Icons (`tools/verify_icons.py`) | 547/547 parse as 16x16 BMP ICOs, all non-blank, 547 distinct hashes, most-shared 1 |
|
||||
| Combined palette (`widgets/tests/test_combined_palette.py`) | ALL PASS — presence 36 LightGUI + 547 XFrame, self-test 583/583, real-mouse select + place |
|
||||
| Palette / layout (`widgets/tests/test_palette_layout.py`) | place 547/547, draw 547/547, PLACE_ALL 547/547, palette self-test 547/547, handle drags 12/12, interactive place/move/resize/delete PASS |
|
||||
| XFrame-only palette (`widgets/tests/test_combined_palette.py`) | ALL PASS — presence 547 XFrame, self-test 547/547, real-mouse select + place in the embedded canvas |
|
||||
| Palette / layout (`widgets/tests/test_palette_layout.py`) | OBSOLETE (step 6): the standalone layout window is deleted; the canvas is embedded in the designer. Last result before deletion: place 547/547, draw 547/547, PLACE_ALL 547/547, palette self-test 547/547, handle drags 12/12, interactive place/move/resize/delete PASS |
|
||||
| Full build (`widgets/build`, all 547 demos + palette + layout) | 0 warnings, 0 errors |
|
||||
| Doc examples (`tools/verify_doc_examples.py`, all docs) | 547/547 compile (66/66 Instrumentation) |
|
||||
| Per-widget pictures (`tools/render_widget_pics.py`) | 547/547 PASS, 0 FAIL; 66/66 picture links in this doc (`tools/link_widget_pics.py --check`) |
|
||||
| Composite (`widgets/build_composite.py`, `verify_composite.py`) | 24x23 grid, 5868x4842, 547 tiles, 0 blank, 0 mismatched, 0 bad labels |
|
||||
| Seam (`widgets/tests/test_layout_to_lightgui.py`) | ALL PASS — 547 entries, 136 mapped (same 136 as before; 0 of the 66 Instrumentation widgets map to a GTK counterpart, never forced), 411 unmapped, 34 approximate, generated project builds |
|
||||
| Seam (`widgets/tests/test_layout_to_lightgui.py`) | ALL PASS — 547 entries, 547 mapped, 0 unmapped, generated project builds |
|
||||
| Group drivers (each widget build + draw + click/key + clean exit) | Tanks 8/8, switches 12/12, lamps 12/12, gauges + panel 38/38 checks, digits + needles ALL PASS, segments ALL PASS — every driver exit 0 |
|
||||
|
||||
One integration fix was needed: `widgets/palette/main_palette.cpp` had a
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 6.3 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 53 KiB After Width: | Height: | Size: 38 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 34 KiB |
+487
-433
File diff suppressed because it is too large.
Load diff
@@ -11,6 +11,12 @@
|
||||
// the format tag. Property values are NOT validated here — the designer
|
||||
// re-validates every property through set_prop() when it rebuilds the
|
||||
// canvas, so a hand-edited file can't smuggle in bad values.
|
||||
//
|
||||
// XFrame-only (step 5): .fdj holds only XFrame widgets. On load, a widget
|
||||
// whose type is not a known XFrame class (e.g. a legacy GTK widget from
|
||||
// an old .fdj) is SKIPPED, not migrated — the load succeeds and the
|
||||
// skipped widgets are reported. Old .fdj files with GTK widgets are
|
||||
// dropped, never converted.
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// GENERATED by widgets/tools/gen_xframe_palette_data.py — do not edit by hand.
|
||||
// The 547 XFrame widgets in their 11 section groups, in section order,
|
||||
// for the combined IDE palette (designer/src/main.cpp). `index` is the
|
||||
// for the combined IDE palette (src/main.cpp). `index` is the
|
||||
// widget's index in widgets/common/registry.h (kWidgetNames) — the same
|
||||
// index the palette -> layout selection file carries.
|
||||
// Section counts: Windows & Dialogs 28, Containers & Layout 34, Buttons 24, Display 33, Text & Entry 28, Choosers 10, Views & Lists 17, Menus & Toolbars 16, Misc / X 4, Stock Market 287, Instrumentation 66.
|
||||
|
||||
-484
@@ -305,490 +305,6 @@
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="pal_button">
|
||||
<property name="label">Button</property>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="pal_label">
|
||||
<property name="label">Label</property>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="pal_entry">
|
||||
<property name="label">Entry</property>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="pal_checkbutton">
|
||||
<property name="label">CheckButton</property>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="pal_radiobutton">
|
||||
<property name="label">RadioButton</property>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="pal_frame">
|
||||
<property name="label">Frame</property>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="pal_combobox">
|
||||
<property name="label">ComboBox</property>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="pal_listbox">
|
||||
<property name="label">ListBox</property>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="pal_menubutton">
|
||||
<property name="label">MenuButton</property>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">5</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="pal_canvas">
|
||||
<property name="label">Canvas</property>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">5</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="pal_scale">
|
||||
<property name="label">Scale</property>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">6</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="pal_scrollbar">
|
||||
<property name="label">Scrollbar</property>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">6</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="pal_text">
|
||||
<property name="label">Text</property>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">7</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="pal_toplevel">
|
||||
<property name="label">Toplevel</property>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">7</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="pal_spreadsheet">
|
||||
<property name="label">Spreadsheet</property>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">8</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="pal_stockchart">
|
||||
<property name="label">StockChart</property>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">8</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="pal_section_lazarus">
|
||||
<property name="label"><b>Lazarus — Basic</b></property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">9</property>
|
||||
<property name="width">2</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="pal_memo">
|
||||
<property name="label">Memo</property>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">10</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="pal_groupbox">
|
||||
<property name="label">GroupBox</property>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">10</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="pal_panel">
|
||||
<property name="label">Panel</property>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">11</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="pal_image">
|
||||
<property name="label">Image</property>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">11</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="pal_shape">
|
||||
<property name="label">Shape</property>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">12</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="pal_section_containers">
|
||||
<property name="label"><b>Containers</b></property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">13</property>
|
||||
<property name="width">2</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="pal_notebook">
|
||||
<property name="label">Notebook</property>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">14</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="pal_scrollbox">
|
||||
<property name="label">ScrollBox</property>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">14</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="pal_splitter">
|
||||
<property name="label">Splitter</property>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">15</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="pal_statusbar">
|
||||
<property name="label">StatusBar</property>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">15</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="pal_toolbar">
|
||||
<property name="label">ToolBar</property>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">16</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="pal_menubar">
|
||||
<property name="label">MenuBar</property>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">16</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="pal_section_input">
|
||||
<property name="label"><b>Input</b></property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">17</property>
|
||||
<property name="width">2</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="pal_spinedit">
|
||||
<property name="label">SpinEdit</property>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">18</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="pal_trackbar">
|
||||
<property name="label">TrackBar</property>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">18</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="pal_progressbar">
|
||||
<property name="label">ProgressBar</property>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">19</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="pal_datetimepicker">
|
||||
<property name="label">DateTimePicker</property>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">19</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="pal_colorbox">
|
||||
<property name="label">ColorBox</property>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">20</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="pal_section_data">
|
||||
<property name="label"><b>Data / Display</b></property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">21</property>
|
||||
<property name="width">2</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="pal_listview">
|
||||
<property name="label">ListView</property>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">22</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="pal_treeview">
|
||||
<property name="label">TreeView</property>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">22</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="pal_stringgrid">
|
||||
<property name="label">StringGrid</property>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">23</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="pal_plot">
|
||||
<property name="label">Plot</property>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">23</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
#!/usr/bin/env python3
|
||||
"""End-to-end test for the combined palette.
|
||||
"""End-to-end test for the XFrame-only palette (step 5).
|
||||
|
||||
1. Freshness: widgets/tools/gen_xframe_palette_data.py --check
|
||||
(the generated src/xframe_palette.h is current).
|
||||
2. Presence: LIGHTGUI_PALETTE_DUMP lists 36 LightGUI entries (exact
|
||||
type set from src/model.h) + one XFrame entry per registered
|
||||
widget in their sections with the exact per-section counts, registry
|
||||
indices matching widgets/common/registry.h, names unique.
|
||||
2. Presence: LIGHTGUI_PALETTE_DUMP lists zero LightGUI entries and
|
||||
one XFrame entry per registered widget in their sections, with
|
||||
the exact per-section counts, registry indices matching
|
||||
widgets/common/registry.h, names unique.
|
||||
3. Selection: LIGHTGUI_PALETTE_SELFTEST drives every palette button
|
||||
through its real clicked handler — 36 canvas adds + one selection
|
||||
write per XFrame widget — and must report pass=<total> fail=0.
|
||||
through its real clicked handler — one canvas selection per
|
||||
XFrame widget — and must report pass=<total> fail=0.
|
||||
4. Interactive (real mouse): under Xvfb, launch ./ide, click the
|
||||
first XFrame entry (GtkAboutDialog) in the combined palette,
|
||||
check the selection file, click in the layout window, check the
|
||||
layout state file shows the real widget placed. Screenshots of
|
||||
the palette (top + scrolled to the XFrame sections) go to
|
||||
screenshots/ by default.
|
||||
first XFrame entry (GtkAboutDialog) in the palette, click in the
|
||||
designer canvas, check the canvas state file shows the real
|
||||
widget placed. Screenshots of the palette (top + scrolled to the
|
||||
XFrame sections) and of the designer canvas go to screenshots/
|
||||
by default.
|
||||
|
||||
Usage: test_combined_palette.py [--display :97] [--shots-dir DIR]
|
||||
The script starts its own Xvfb on the display if none is running there
|
||||
@@ -68,11 +68,6 @@ def registry_names():
|
||||
return _wc_registry_names()
|
||||
|
||||
|
||||
def designer_types():
|
||||
text = open(os.path.join(DESIGNER, "src", "model.h")).read()
|
||||
return re.findall(r'\{"(\w+)",\s*"pal_', text)
|
||||
|
||||
|
||||
def xdotool(*args, timeout=10):
|
||||
env = dict(os.environ, DISPLAY=DISPLAY)
|
||||
return subprocess.run(["xdotool"] + list(args), capture_output=True,
|
||||
@@ -119,10 +114,10 @@ def main():
|
||||
args = ap.parse_args()
|
||||
DISPLAY = args.display
|
||||
os.makedirs(args.shots_dir, exist_ok=True)
|
||||
N = widget_count() # derived XFrame count; 36 + N is the palette total
|
||||
N = widget_count() # derived XFrame count; N is the palette total
|
||||
|
||||
# 0. Clean stale IPC files so reads below are fresh.
|
||||
for p in ("/tmp/lightgui-selection.txt", "/tmp/lightgui-layout-state.txt"):
|
||||
# 0. Clean the stale canvas state file so reads below are fresh.
|
||||
for p in ("/tmp/lightgui-xframe-canvas-state.txt",):
|
||||
try:
|
||||
os.unlink(p)
|
||||
except FileNotFoundError:
|
||||
@@ -179,10 +174,8 @@ def main():
|
||||
name = parts[-4]
|
||||
section = " ".join(parts[1:-4])
|
||||
xf.append((section, name, idx, x, y))
|
||||
want_fd = designer_types()
|
||||
assert len(want_fd) == 36, f"model.h has {len(want_fd)} types"
|
||||
if sorted(fd) != sorted(want_fd):
|
||||
fail(f"LightGUI entries mismatch: {sorted(set(fd) ^ set(want_fd))}")
|
||||
if fd:
|
||||
fail(f"palette still lists LightGUI entries: {fd[:5]}")
|
||||
if len(xf) != N:
|
||||
fail(f"expected {N} XFrame entries, got {len(xf)}")
|
||||
names = [n for _, n, _, _, _ in xf]
|
||||
@@ -199,7 +192,7 @@ def main():
|
||||
ys = [y for *_, y in xf]
|
||||
if ys != sorted(ys):
|
||||
fail("XFrame entries not in increasing y order")
|
||||
print(f"PASS presence: 36 LightGUI + {N} XFrame, sections {counts}")
|
||||
print(f"PASS presence: 0 LightGUI + {N} XFrame, sections {counts}")
|
||||
finally:
|
||||
proc.terminate()
|
||||
try:
|
||||
@@ -214,10 +207,10 @@ def main():
|
||||
log = open(slog).read() if os.path.exists(slog) else ""
|
||||
fails = [l for l in log.splitlines() if l.startswith("FAIL")]
|
||||
m = re.search(r"SUMMARY pass=(\d+) fail=(\d+)", log)
|
||||
if r.returncode != 0 or not m or m.group(1) != str(36 + N) or m.group(2) != "0":
|
||||
if r.returncode != 0 or not m or m.group(1) != str(N) or m.group(2) != "0":
|
||||
print(log[-2000:])
|
||||
fail(f"palette self-test failed (exit {r.returncode}): {fails[:5]}")
|
||||
print(f"PASS self-test: {36 + N}/{36 + N} buttons select (36 canvas + {N} selection writes)")
|
||||
print(f"PASS self-test: {N}/{N} buttons select (canvas selection writes)")
|
||||
|
||||
# 5. Interactive: real mouse through ./ide.
|
||||
try:
|
||||
@@ -236,14 +229,16 @@ def main():
|
||||
time.sleep(0.1)
|
||||
else:
|
||||
fail("ide did not open the palette window")
|
||||
time.sleep(1.0) # let all five windows settle
|
||||
time.sleep(1.0) # let all windows settle
|
||||
titles = xdotool("search", "--name", ".*", "getwindowname", "%@").stdout
|
||||
for want in ("LightGUI — C++/GTK", "LightGUI — Widgets",
|
||||
"LightGUI — Code", "LightGUI Palette",
|
||||
"LightGUI Layout"):
|
||||
"LightGUI — Code"):
|
||||
if want not in titles:
|
||||
fail(f"ide window missing: {want}")
|
||||
print("PASS ide opens all five top-level windows")
|
||||
for gone in ("LightGUI Palette", "LightGUI Layout"):
|
||||
if gone in titles:
|
||||
fail(f"dead window still opens: {gone}")
|
||||
print("PASS ide opens the designer + palette + code windows (no palette/layout processes)")
|
||||
|
||||
# Dump coords for the first XFrame entry (visible at scroll-top).
|
||||
entry = None
|
||||
@@ -258,30 +253,28 @@ def main():
|
||||
cx, cy = px + entry[0] + 60, py + entry[1] + 10
|
||||
xdotool("mousemove", str(cx), str(cy), "click", "1")
|
||||
time.sleep(0.7)
|
||||
sel = open("/tmp/lightgui-selection.txt").read().splitlines()
|
||||
if sel[:1] != ["GtkAboutDialog"] or sel[1:2] != ["0"]:
|
||||
fail(f"selection file after palette click: {sel}")
|
||||
print("PASS real click selects GtkAboutDialog (selection file)")
|
||||
|
||||
lay = win_id("LightGUI Layout")
|
||||
lx, ly, lw, lh = win_geom(lay)
|
||||
# Raise it first: the designer/code windows overlap it, and a
|
||||
# No selection file anymore (step 5/6): selection is
|
||||
# in-process. Prove it by placing: click in the designer
|
||||
# canvas and check the canvas state file.
|
||||
des = win_id(r"LightGUI — C\+\+")
|
||||
dx, dy, dw, dh = win_geom(des)
|
||||
# Raise it first: the palette/code windows overlap it, and a
|
||||
# click lands on whatever is topmost at that point.
|
||||
xdotool("windowraise", str(lay))
|
||||
xdotool("windowraise", str(des))
|
||||
time.sleep(0.5)
|
||||
xdotool("mousemove", str(lx + 200), str(ly + 200), "click", "1")
|
||||
xdotool("mousemove", str(dx + 400), str(dy + 300), "click", "1")
|
||||
state = ""
|
||||
for _ in range(30):
|
||||
time.sleep(0.1)
|
||||
try:
|
||||
state = open("/tmp/lightgui-layout-state.txt").read()
|
||||
state = open("/tmp/lightgui-xframe-canvas-state.txt").read()
|
||||
except FileNotFoundError:
|
||||
continue
|
||||
if "GtkAboutDialog" in state:
|
||||
break
|
||||
if "GtkAboutDialog" not in state:
|
||||
fail(f"layout state after place click has no GtkAboutDialog:\n{state[:500]}")
|
||||
print("PASS real click places the real GtkAboutDialog in the layout window")
|
||||
fail(f"canvas state after place click has no GtkAboutDialog:\n{state[:500]}")
|
||||
print("PASS real click places the real GtkAboutDialog in the embedded canvas")
|
||||
|
||||
# Screenshots: palette at top, then scrolled to XFrame sections.
|
||||
def shot(wid, path):
|
||||
@@ -299,9 +292,9 @@ def main():
|
||||
xdotool("click", "5")
|
||||
time.sleep(0.05)
|
||||
shot(pal, os.path.join(args.shots_dir, "combined_palette_xframe.png"))
|
||||
shot(lay, os.path.join(args.shots_dir, "combined_palette_layout_placed.png"))
|
||||
shot(des, os.path.join(args.shots_dir, "combined_palette_canvas_placed.png"))
|
||||
finally:
|
||||
did = win_id("LightGUI — C\+\+")
|
||||
did = win_id(r"LightGUI — C\+\+")
|
||||
if did:
|
||||
xdotool("windowclose", str(did))
|
||||
try:
|
||||
@@ -314,7 +307,7 @@ def main():
|
||||
if xvfb:
|
||||
xvfb.terminate()
|
||||
|
||||
print("COMBINED PALETTE TEST: ALL PASS")
|
||||
print("XFRAME PALETTE TEST: ALL PASS")
|
||||
return 0
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ Steps:
|
||||
1. Build a layout file with all XFrame names (read from
|
||||
widgets/common/registry.h, the single source of truth).
|
||||
2. Run tools/layout_to_lightgui.py; check exit code, .fdj JSON,
|
||||
every widget type is a real designer type, geometry preserved,
|
||||
every widget type is a registry XFrame name, geometry preserved,
|
||||
every name accounted for (mapped or reported unmapped).
|
||||
3. Compile a small C++ harness against src/ that loads the
|
||||
.fdj with the real project_io and generates code with the real
|
||||
@@ -30,16 +30,9 @@ WIDGETS = os.path.join(REPO, "widgets")
|
||||
DESIGNER_SRC = os.path.join(REPO, "src")
|
||||
CONVERTER = os.path.join(WIDGETS, "tools", "layout_to_lightgui.py")
|
||||
|
||||
# The 36 designer types (src/model.h kTypes).
|
||||
DESIGNER_TYPES = {
|
||||
"Button", "Label", "Entry", "Checkbutton", "Radiobutton", "Frame",
|
||||
"Combobox", "Listbox", "Menubutton", "Canvas", "Scale", "Scrollbar",
|
||||
"Text", "Toplevel", "Spreadsheet", "StockChart", "Memo", "GroupBox",
|
||||
"Panel", "Image", "Shape", "Notebook", "ScrollBox", "Splitter",
|
||||
"StatusBar", "ToolBar", "MenuBar", "SpinEdit", "TrackBar",
|
||||
"ProgressBar", "DateTimePicker", "ColorBox", "ListView", "TreeView",
|
||||
"StringGrid", "Plot",
|
||||
}
|
||||
# Step 5: .fdj is XFrame-only — widget types are registry XFrame
|
||||
# class names, not the 36 old GTK designer types (src/model.h kTypes).
|
||||
# The registry names are parsed from registry.h in main() below.
|
||||
|
||||
HARNESS_CPP = r"""
|
||||
#include <cstdio>
|
||||
@@ -103,8 +96,8 @@ def main():
|
||||
assert fdj["format"] == "lightgui" and fdj["version"] == 1
|
||||
by_type = {}
|
||||
for w in fdj["widgets"]:
|
||||
if w["type"] not in DESIGNER_TYPES:
|
||||
fail(f"widget {w['name']} has unknown designer type {w['type']}")
|
||||
if w["type"] not in names:
|
||||
fail(f"widget {w['name']} has unknown XFrame type {w['type']}")
|
||||
by_type.setdefault(w["type"], 0)
|
||||
by_type[w["type"]] += 1
|
||||
names_in = {w["name"] for w in fdj["widgets"]}
|
||||
@@ -114,16 +107,16 @@ def main():
|
||||
assert len(btn) == 1, f"expected 1 GtkButton widget, got {len(btn)}"
|
||||
_i = names.index("GtkButton")
|
||||
assert (btn[0]["x"], btn[0]["y"], btn[0]["width"], btn[0]["height"]) == ((_i % 10) * 130, (_i // 10) * 90, 120, 40), btn[0]
|
||||
sys.path.insert(0, os.path.join(WIDGETS, "tools"))
|
||||
import layout_to_lightgui as conv
|
||||
mapped_n = len(conv.MAPPING)
|
||||
unmapped_n = N - mapped_n
|
||||
# Step 5: the converter is the identity mapping — every registry
|
||||
# name maps through, nothing is unmapped.
|
||||
mapped_n = N
|
||||
unmapped_n = 0
|
||||
assert len(fdj["widgets"]) == mapped_n, (
|
||||
f"expected {mapped_n} mapped widgets, got {len(fdj['widgets'])}")
|
||||
assert "unmapped" in r.stdout and str(unmapped_n) in r.stdout, (
|
||||
f"report should mention {unmapped_n} unmapped")
|
||||
print(f"PASS converter: {mapped_n} mapped, {unmapped_n} unmapped, "
|
||||
f"{len(by_type)} designer types used, geometry preserved")
|
||||
f"{len(by_type)} XFrame types used, geometry preserved")
|
||||
|
||||
# 3. Real load + generate via the designer's own sources.
|
||||
harness_cpp = os.path.join(tmp, "harness.cpp")
|
||||
|
||||
@@ -1,27 +1,22 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Convert a LightGUI layout file into an LightGUI project (.fdj).
|
||||
"""Convert a LightGUI layout file into a LightGUI project (.fdj).
|
||||
|
||||
The layout tool saves placed XFrame widgets as one line each:
|
||||
<XFrameName> <x> <y> <width> <height>
|
||||
(e.g. `GtkButton 40 40 120 30`, written by `lightgui_layout` on `s` or
|
||||
by its SAVE script command). This converter maps each XFrame widget to
|
||||
the closest LightGUI (GTK) widget type and writes a .fdj project that
|
||||
the designer opens with File -> Open project. From there the normal
|
||||
designer flow applies: File -> Generate C++/GTK, Build with CMake,
|
||||
and debug with the stepping debugger (code window + auto variables).
|
||||
(e.g. `GtkButton 40 40 120 30`, written by the old `lightgui_layout`
|
||||
on `s` or by its SAVE script command). This converter writes a .fdj
|
||||
project that the designer opens with File -> Open project. From there
|
||||
the normal designer flow applies: File -> Generate C++ (XFrame),
|
||||
Build with CMake, and debug with the stepping debugger (code window +
|
||||
auto variables).
|
||||
|
||||
What the seam is and is not:
|
||||
IS - geometry + type mapping: layout -> .fdj -> generated GTK code.
|
||||
IS - honest about approximation: many XFrame widgets have
|
||||
a real GTK counterpart; dialogs, choosers, menus and other
|
||||
XFrame-only widgets have none and are reported, never silently
|
||||
forced into a wrong type.
|
||||
IS NOT - a live bridge: the XFrame widgets are re-created as GTK widgets
|
||||
in the generated code; the generated app does not link or
|
||||
instantiate XFrame classes, and edits in the layout window do
|
||||
not flow back into the designer (re-run the converter).
|
||||
IS NOT - pixel-identical: XFrame draws its own look with raw Xlib;
|
||||
the GTK equivalents look like GTK widgets.
|
||||
Step 5 (Nov 29, 2026): .fdj is XFrame-only, so the mapping is the
|
||||
identity — the .fdj carries the XFrame class name as the widget type,
|
||||
and the generated app instantiates the XFrame classes directly. Names
|
||||
that are not in the registry (widgets/common/registry.h) are reported
|
||||
and skipped, never forced into a wrong type. (The old GTK mapping —
|
||||
136 of the 547 widgets to a nearest GTK counterpart — is gone with
|
||||
the GTK palette.)
|
||||
|
||||
Usage:
|
||||
layout_to_lightgui.py [--class-name Name] [--title Title]
|
||||
@@ -32,78 +27,13 @@ Exit codes: 0 = at least one widget mapped; 1 = usage/input error;
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
|
||||
# Designer type -> XFrame names. Names listed in APPROX below are
|
||||
# closest-match mappings (not the same widget, but the nearest GTK
|
||||
# equivalent); the rest are direct counterparts.
|
||||
GROUPS = [
|
||||
("Button", ["GtkButton", "TButton", "TBitBtn", "TSpeedButton"]),
|
||||
("Label", ["GtkLabel", "GtkAccelLabel", "GtkInscription", "TLabel",
|
||||
"TStaticText", "GtkEditableLabel"]),
|
||||
("Entry", ["GtkEntry", "GtkPasswordEntry", "GtkSearchEntry", "TEdit",
|
||||
"TMaskEdit", "TLabeledEdit", "TEditButton", "TFileNameEdit",
|
||||
"TDirectoryEdit", "GtkEntryCompletion"]),
|
||||
("Checkbutton", ["GtkCheckButton", "GtkCheckMenuItem", "GtkToggleButton",
|
||||
"TCheckBox", "TToggleBox", "GtkSwitch",
|
||||
"GtkToggleToolButton"]),
|
||||
("Radiobutton", ["GtkRadioButton", "TRadioButton"]),
|
||||
("Frame", ["GtkFrame", "GtkAspectFrame", "TFrame"]),
|
||||
("GroupBox", ["TGroupBox", "GtkExpander", "TCheckGroup", "TRadioGroup"]),
|
||||
("Panel", ["TPanel", "GtkBox", "GtkCenterBox", "GtkButtonBox", "GtkFlowBox",
|
||||
"GtkGrid", "TFlowPanel", "GtkFixed", "GtkLayout", "GtkOverlay",
|
||||
"GtkViewport", "GtkEventBox"]),
|
||||
("Combobox", ["GtkComboBox", "GtkComboBoxText", "GtkDropDown", "TComboBox",
|
||||
"TComboBoxEx", "TCheckComboBox", "TFilterComboBox"]),
|
||||
("Listbox", ["GtkListBox", "TListBox", "TCheckListBox", "TFileListBox"]),
|
||||
("ListView", ["GtkListView", "TListView", "GtkColumnView", "GtkIconView",
|
||||
"GtkGridView", "TShellListView", "TColorListBox"]),
|
||||
("TreeView", ["GtkTreeView", "TTreeView", "TShellTreeView"]),
|
||||
("Menubutton", ["GtkMenuButton", "GtkModelButton", "GtkLinkButton"]),
|
||||
("MenuBar", ["GtkMenuBar", "TMainMenu"]),
|
||||
("ToolBar", ["GtkToolbar", "TToolBar", "TControlBar", "TCoolBar",
|
||||
"GtkHeaderBar", "GtkActionBar"]),
|
||||
("Canvas", ["GtkDrawingArea", "TPaintBox", "GtkGLArea"]),
|
||||
("Scale", ["GtkScale", "GtkScaleButton"]),
|
||||
("TrackBar", ["TTrackBar"]),
|
||||
("SpinEdit", ["GtkSpinButton", "TSpinEdit", "TFloatSpinEdit", "TCalcEdit",
|
||||
"TUpDown"]),
|
||||
("Scrollbar", ["GtkScrollbar", "TScrollBar"]),
|
||||
("Memo", ["GtkTextView", "TMemo"]),
|
||||
("Notebook", ["GtkNotebook", "TNotebook", "TPageControl", "GtkStack",
|
||||
"GtkStackSwitcher", "TTabControl"]),
|
||||
("ScrollBox", ["GtkScrolledWindow", "TScrollBox"]),
|
||||
("Splitter", ["GtkPaned", "TPairSplitter", "TSplitter"]),
|
||||
("StatusBar", ["GtkStatusbar", "TStatusBar"]),
|
||||
("ProgressBar", ["GtkProgressBar", "GtkLevelBar", "TProgressBar",
|
||||
"GtkSpinner"]),
|
||||
("DateTimePicker", ["GtkCalendar", "TCalendar", "TDateEdit",
|
||||
"TDateTimePicker", "TTimeEdit"]),
|
||||
("ColorBox", ["GtkColorButton", "TColorBox", "TColorButton"]),
|
||||
("Image", ["GtkImage", "GtkPicture", "TImage", "TImageList"]),
|
||||
("StringGrid", ["TStringGrid", "TDrawGrid", "TValueListEditor"]),
|
||||
("Spreadsheet", ["XSpreadsheet"]),
|
||||
("Plot", ["XGraph"]),
|
||||
("Toplevel", ["GtkWindow", "GtkApplicationWindow", "TForm"]),
|
||||
("Shape", ["TShape", "TBevel", "TArrow", "GtkSeparator"]),
|
||||
]
|
||||
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
||||
from widget_count import registry_names
|
||||
|
||||
# Names whose mapping is a nearest-match approximation, not the same widget.
|
||||
APPROX = {
|
||||
"GtkEditableLabel", "GtkEntryCompletion", "GtkSwitch", "GtkToggleToolButton",
|
||||
"GtkExpander", "TCheckGroup", "TRadioGroup", "GtkOverlay", "GtkViewport",
|
||||
"GtkEventBox", "TColorListBox", "GtkLinkButton", "GtkHeaderBar", "GtkActionBar",
|
||||
"GtkGLArea", "GtkScaleButton", "TCalcEdit", "TUpDown", "GtkStack",
|
||||
"GtkStackSwitcher", "TTabControl", "GtkSpinner", "GtkCalendar", "TCalendar",
|
||||
"TDateEdit", "TTimeEdit", "TImageList", "TDrawGrid", "TValueListEditor",
|
||||
"GtkWindow", "GtkApplicationWindow", "TForm", "TBevel", "TArrow", "GtkSeparator",
|
||||
}
|
||||
|
||||
MAPPING = {} # XFrame name -> (designer type, approximate?)
|
||||
for _dtype, _names in GROUPS:
|
||||
for _n in _names:
|
||||
assert _n not in MAPPING, f"duplicate mapping for {_n}"
|
||||
MAPPING[_n] = (_dtype, _n in APPROX)
|
||||
REGISTRY = set(registry_names())
|
||||
|
||||
|
||||
def parse_layout(path):
|
||||
@@ -129,32 +59,28 @@ def parse_layout(path):
|
||||
|
||||
|
||||
def convert(entries, class_name, title):
|
||||
"""Build the .fdj dict; return (project, mapped, unmapped, approx_used)."""
|
||||
"""Build the .fdj dict; return (project, mapped, unmapped)."""
|
||||
counters = {}
|
||||
widgets = []
|
||||
mapped, unmapped, approx_used = [], [], []
|
||||
mapped, unmapped = [], []
|
||||
max_right, max_bottom = 0, 0
|
||||
for name, x, y, w, h in entries:
|
||||
hit = MAPPING.get(name)
|
||||
if hit is None:
|
||||
if name not in REGISTRY:
|
||||
unmapped.append(name)
|
||||
continue
|
||||
dtype, approx = hit
|
||||
counters[dtype] = counters.get(dtype, 0) + 1
|
||||
wname = f"{dtype}_{counters[dtype]:03d}"
|
||||
counters[name] = counters.get(name, 0) + 1
|
||||
wname = f"{name}_{counters[name]:03d}"
|
||||
widgets.append({
|
||||
"name": wname,
|
||||
"type": dtype,
|
||||
"type": name,
|
||||
"x": x, "y": y, "width": w, "height": h,
|
||||
# The label keeps the XFrame origin visible in the designer
|
||||
# and in the generated code. The generator only emits a
|
||||
# "label" property where the widget type declares one.
|
||||
# and in the generated code (the generator emits set_text
|
||||
# for a "label" prop on most widget types).
|
||||
"props": {"label": name},
|
||||
"signals": [],
|
||||
})
|
||||
mapped.append(name)
|
||||
if approx:
|
||||
approx_used.append((name, dtype))
|
||||
max_right = max(max_right, x + w)
|
||||
max_bottom = max(max_bottom, y + h)
|
||||
project = {
|
||||
@@ -170,7 +96,7 @@ def convert(entries, class_name, title):
|
||||
},
|
||||
"widgets": widgets,
|
||||
}
|
||||
return project, mapped, unmapped, approx_used
|
||||
return project, mapped, unmapped
|
||||
|
||||
|
||||
def main(argv=None):
|
||||
@@ -194,20 +120,16 @@ def main(argv=None):
|
||||
print("layout_to_lightgui: no widget entries found", file=sys.stderr)
|
||||
return 1
|
||||
|
||||
project, mapped, unmapped, approx_used = convert(entries, args.class_name, args.title)
|
||||
project, mapped, unmapped = convert(entries, args.class_name, args.title)
|
||||
with open(args.out, "w") as f:
|
||||
json.dump(project, f, indent=2)
|
||||
f.write("\n")
|
||||
|
||||
print(f"layout_to_lightgui: {len(entries)} entries, "
|
||||
f"{len(mapped)} mapped to {len(project['widgets'])} designer widgets, "
|
||||
f"{len(mapped)} mapped to {len(project['widgets'])} XFrame widgets, "
|
||||
f"{len(unmapped)} unmapped")
|
||||
if approx_used:
|
||||
print("approximate mappings (nearest GTK equivalent, not the same widget):")
|
||||
for name, dtype in sorted(set(approx_used)):
|
||||
print(f" {name} -> {dtype}")
|
||||
if unmapped:
|
||||
print("unmapped (no LightGUI equivalent -- skipped, not forced):")
|
||||
print("unmapped (not XFrame widget names -- skipped, not forced):")
|
||||
for name in sorted(set(unmapped)):
|
||||
print(f" {name}")
|
||||
print(f"wrote {args.out} "
|
||||
|
||||
Reference in new issue
Block a user