Register the 15 new X* monitor widgets (includes, kWidgetNames,
kWidgetSection as Misc / X, factory cases 547-561, kWidgetCount
562); sections.py Misc / X assignment; regenerate
src/xframe_palette.h (562 entries, palette --check clean); 16x16
icons; README 547 -> 562 plus X* monitor-family section with
per-widget one-liners and example build/run commands.
Also fix a pre-existing seam-test failure (proven on clean main
9088092): the generator emitted .w.set_label() for the
Frame/GroupBox/Panel kinds, but TFrame / TGroupBox / TPanel only
have set_text — gate the GtkFrame-only setters on the mapped class
being GtkFrame so the other classes fall through to set_text.
make test (seam test) now passes: 562 mapped, generated project
builds.
316 lines
15 KiB
Markdown
316 lines
15 KiB
Markdown
# LightGUI — a visual GUI designer in C++/GTK
|
||
|
||
LightGUI is a visual designer for building GTK 3 applications in C++. Place
|
||
widgets on a canvas at absolute positions, edit their properties, then
|
||
generate runnable C++/GTK source code — a `.ui` layout file plus a C++ class
|
||
with stub signal handlers, ready to fill in and build.
|
||
|
||
It is a C++ rebuild of the author's `lightgui` (Tkinter Rapid Designer), a
|
||
~7,000-line Python/Tkinter app. The C++ version generates C++/GTK code, not
|
||
Tkinter Python, and its own UI is GTK as well, defined in Glade `.ui` files.
|
||
No Qt anywhere.
|
||
|
||

|
||
|
||
## Features
|
||
|
||
- **Visual canvas** — place widgets at absolute positions and sizes, the
|
||
GTK equivalent of Tk's `.place()`. Drag, resize, align, and multi-select.
|
||
- **Object Inspector** — its own top-level window: edit every widget
|
||
property, with bulk parameter operations across a selection. It is a
|
||
separate window from the layout window, so each can be moved, resized,
|
||
and closed independently.
|
||
- **Code generation** — for each designed window, emits:
|
||
- `<name>.ui` — a Glade/GtkBuilder layout file (GtkWindow + GtkFixed,
|
||
widgets at their designed x/y with width/height requests).
|
||
- `<name>.h` / `<name>.cpp` — a C++ class that loads the `.ui` with
|
||
GtkBuilder, fetches each widget by id, and declares one stub signal
|
||
handler per connected signal (`// Code block here`), ready to fill in.
|
||
- A `Makefile` **and** a `CMakeLists.txt`, so a generated project builds
|
||
with either tool.
|
||
- **CMake support** — build a generated project with CMake from inside the
|
||
designer, rebuild the last generated project, or open any directory
|
||
holding a `CMakeLists.txt` and build it.
|
||
- **Stepping debugger** — a real GDB session over the MI protocol
|
||
(`gdb -q -i=mi2`): Run, Continue, Step Over/Into/Out, Stop, Restart,
|
||
breakpoints (`file.cpp:123` or a function name, saved between runs),
|
||
locals, a watch list, stack frames, and target stdout/stderr. Works on
|
||
any program compiled with `-g`.
|
||
- **Code view** — inspect the generated code without leaving the designer.
|
||
- **Themes and fonts** — color themes and global font settings for the
|
||
designer itself.
|
||
- **Widget palette** — the full Tk palette mapped to GTK 3 (Window, Frame,
|
||
Button, Label, Entry, CheckButton, RadioButton, ComboBox, ListBox, Menu,
|
||
Notebook, TreeView, and more), each with its own 16×16 icon.
|
||
- **562 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.
|
||
|
||
- **X\* monitor family (15 widgets)** — live system-monitor widgets in
|
||
the XFrame set (btop-style visuals), alongside XGraph and XSpreadsheet:
|
||
|
||
| Widget | What it shows |
|
||
| ------ | ------------- |
|
||
| `XHistoryGraph` | Scrolling multi-series time-series graph, 60 s window, cur/min/max/avg legend |
|
||
| `XCoreGrid` | Grid of mini history graphs, one per CPU core, label + current % each |
|
||
| `XNetGraph` | Dual up/down scrolling graph, current rates + running totals |
|
||
| `XTempHistory` | Temperature history with threshold line + over-temp colouring |
|
||
| `XUsageBar` | Horizontal gradient usage bar with label + % text |
|
||
| `XStackBar` | Stacked multi-segment bar (used/cached/buffers/free) with legend |
|
||
| `XVerticalBar` | Vertical bar meter with scale + peak-hold marker (click resets peak) |
|
||
| `XTachometer` | Round tachometer: needle, redline zone, digital readout, peak hold |
|
||
| `XArcGauge` | Semicircular arc gauge, coloured zones, big % in the middle |
|
||
| `XDonutGauge` | Circular progress ring with % centred |
|
||
| `XProcessList` | Live process table from `/proc`: sortable columns, in-cell CPU% bars, auto-refresh |
|
||
| `XLoadBadge` | Load-average badge (1/5/15 min), colour thresholds, uptime |
|
||
| `XMonitorButton` | A button that is a live monitor: process (by name), systemd unit, or TCP port |
|
||
| `XMonitorGrid` | Panel of `XMonitorButton`s in a labelled grid, one shared poll timer |
|
||
| `XSysBox` | Composite resource box: title + big number + history graph + usage bar |
|
||
|
||
Build and run any monitor widget demo from the repo root (needs X;
|
||
use Xvfb headless):
|
||
|
||
```sh
|
||
g++ -std=c++17 -Iwidgets/components examples/XHistoryGraph.cpp -lX11 -o XHistoryGraph
|
||
xvfb-run -a ./XHistoryGraph
|
||
```
|
||
|
||
- **XFrame-only palette** — 562 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.
|
||
|
||

|
||

|
||
|
||
## Requirements
|
||
|
||
LightGUI builds and runs on Linux with GTK 3. This section assumes a
|
||
**bare system** — a fresh ParrotOS (or Debian/Ubuntu) install with nothing
|
||
yet installed. One command installs the compiler and everything else; you
|
||
do not need anything beforehand, not even `make` or a C++ compiler.
|
||
|
||
### Install (Debian / Ubuntu / ParrotOS)
|
||
|
||
```sh
|
||
sudo apt update && sudo apt install build-essential pkg-config libgtk-3-dev glade cmake gdb xvfb python3
|
||
```
|
||
|
||
That single command is the complete toolchain from scratch: the compiler,
|
||
the build tools, GTK 3, and every feature dependency. Nothing else is
|
||
required to build and run LightGUI.
|
||
|
||
What each package is for:
|
||
|
||
| Package | Needed for |
|
||
|---|---|
|
||
| `build-essential` | **The build tools themselves** — provides `make` (which runs the Makefile) and `g++` (the C++17 compiler), plus the C library headers. Without it, `make` is not even installed. |
|
||
| `pkg-config` | Finding the GTK 3 compiler and linker flags (`gtk+-3.0`) |
|
||
| `libgtk-3-dev` | **GTK 3 itself** — the development package for GTK 3. Installing it also pulls in the GTK 3 runtime libraries (`libgtk-3-0`), so there is no separate `gtk3` package to install. It also pulls in Cairo and GDK, which the source uses. |
|
||
| `glade` | Editing the designer's own `.ui` files (optional for building and running) |
|
||
| `cmake` | The CMake build path for generated projects, and File → Open CMake Project |
|
||
| `gdb` | The integrated stepping debugger (GDB/MI) |
|
||
| `xvfb` | Running the GUI tests headless |
|
||
| `python3` | The palette-icon generator tool (`tools/gen_palette_icons.py`) |
|
||
|
||
Optional, for the full GUI test suite:
|
||
|
||
```sh
|
||
sudo apt install xdotool
|
||
```
|
||
|
||
Without `xdotool` the GUI end-to-end tests print `SKIP` and the rest of
|
||
the suite still runs.
|
||
|
||
GTK 3.24 is the target toolkit — GTK 4 has no Glade, so this project stays
|
||
on GTK 3. It runs on X11 (GTK 3's X11 backend).
|
||
|
||
### Troubleshooting: `libgtk-3-dev` won't install (dependency conflict)
|
||
|
||
On some systems `sudo apt install libgtk-3-dev` fails with `Unsatisfied
|
||
dependencies` / `Unable to correct problems, you have held broken
|
||
packages`. The usual cause is a version mismatch: the system already has
|
||
newer runtime libraries (for example ATK libraries at 2.62.1 from Debian
|
||
backports, `~bpo13+1`), while `libgtk-3-dev` pulls the older stable dev
|
||
packages (2.56.2), which demand the older runtimes at exactly that
|
||
version — and apt will not downgrade the runtimes on its own.
|
||
|
||
Try these in order:
|
||
|
||
**1. Prefer backports for this install**, so the dev packages match the
|
||
backports runtimes already installed:
|
||
|
||
```sh
|
||
sudo apt install -t trixie-backports libgtk-3-dev
|
||
```
|
||
|
||
(Use the backports suite name for your release if it differs — on
|
||
Debian 13 it is `trixie-backports`, on ParrotOS it is `echo-backports`,
|
||
**not** `trixie-backports`. So on ParrotOS the command is
|
||
`sudo apt install -t echo-backports libgtk-3-dev`.)
|
||
|
||
**2. Let aptitude resolve it:**
|
||
|
||
```sh
|
||
sudo apt install aptitude
|
||
sudo aptitude install libgtk-3-dev
|
||
```
|
||
|
||
Accept the solution that uses the newer dev packages matching your
|
||
installed runtimes, instead of downgrading anything.
|
||
|
||
**3. Last resort — headers only:** download the `-dev` .debs and install
|
||
them with `dpkg --force-depends`. That installs just the headers without
|
||
touching the runtime libraries. Only do this if options 1 and 2 fail.
|
||
|
||
### Per-distro install scripts (tested 2026-11-28)
|
||
|
||
Each distro below was verified end to end in its own LXC container
|
||
(images from images.linuxcontainers.org, 4 CPU cores, 15 GB RAM, 30 GB
|
||
disk, SSH verified from the host): update/upgrade, install the toolchain
|
||
with the distro's own package manager, `git clone` this repo, `make` —
|
||
and the `lightgui` binary was produced. Run the script for your distro
|
||
as root, or with `sudo` (`sudo bash install-ubuntu.sh`).
|
||
|
||
| Distro | Version tested | Script | gtk+-3.0 | Notes |
|
||
|---|---|---|---|---|
|
||
| Ubuntu | 24.04.5 LTS (noble) | `install-ubuntu.sh` | 3.24.41 | The plain README command works as-is; no extra step. |
|
||
| Debian | 13 (trixie) | `install-debian.sh` | 3.24.49 | The plain README command works as-is; no backports needed on a fresh minimal install (no backports runtimes preinstalled, so no conflict). |
|
||
| Fedora | 43 | `install-fedora.sh` | 3.24.52 | `dnf update`, then `dnf install -y git gcc gcc-c++ make pkg-config gtk3-devel glade cmake gdb xorg-x11-server-Xvfb python3` — Fedora has no `build-essential` / `-dev` split; `gtk3-devel` is the GTK dev package. |
|
||
| Arch Linux | rolling (`current`) | `install-arch.sh` | 3.24.52 | **`pacman-key --init` + `pacman-key --populate archlinux` is required first** — the LXC Arch image ships with an empty keyring, so every install fails with `signature ... is unknown trust` until the keyring is populated. Then `pacman -S --noconfirm --needed git base-devel pkgconf gtk3 glade cmake gdb xorg-server-xvfb python` (`pkgconf` provides `pkg-config`; `gtk3` already includes the headers). |
|
||
| Linux Mint | 22.3 (Zena, Ubuntu noble based) | `install-mint.sh` | 3.24.33 | Same apt command as Ubuntu; Mint's repos ship an older GTK (3.24.33 vs Ubuntu's 3.24.41). A native Mint LXC image exists (`mint zena`). |
|
||
| ParrotOS | — (see note) | `install-parrot.sh` | 3.24.49 on stand-in | **No native Parrot LXC image exists**, so this was tested on Parrot's parent, Debian 13 (trixie). The same apt commands apply on real ParrotOS — but if `libgtk-3-dev` conflicts, the backports suite on Parrot is `echo-backports`, **not** `trixie-backports` (see Troubleshooting above). |
|
||
|
||
Test-environment note: on the LXC host used for these tests, the
|
||
containers initially could not reach GitHub at all (IPv4 only — GitHub
|
||
has no IPv6 address) because the host's iptables `FORWARD` chain was
|
||
`DROP` with rules only for Docker's bridges, so LXC's IPv4 masquerade
|
||
never saw a packet. Restoring the standard lxcbr0 `FORWARD` accepts
|
||
fixed it. That is specific to that host, not to these scripts — on a
|
||
normal desktop install `git clone` just works.
|
||
|
||
## Build and run
|
||
|
||
```sh
|
||
make
|
||
```
|
||
|
||
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 **designer** (single process): designer window with the embedded XFrame canvas, the XFrame-only palette window (562 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` 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 562 XFrame widget demos
|
||
(`make lightgui` builds just the designer, `make widgets` just the
|
||
demos). The designer is built from per-file `.o` compiles plus a link
|
||
step, driven by a plain Makefile that parallelises by default (it uses
|
||
all available cores), using `pkg-config --cflags --libs gtk+-3.0`. No
|
||
configure step, no external build system for LightGUI itself.
|
||
`make clean` removes the binary and the demos.
|
||
|
||
To open an existing design, pass its `.fdj` file:
|
||
|
||
```sh
|
||
./lightgui mywindow.fdj
|
||
```
|
||
|
||
(`./ide` does not take a `.fdj` argument — open a design from
|
||
File → Open once it is running, or launch the designer directly with
|
||
`./lightgui mywindow.fdj`.)
|
||
|
||
## Using the designer
|
||
|
||
1. Pick a widget from the palette and place it on the canvas.
|
||
2. Edit its properties in the Object Inspector window (position, size,
|
||
label, signal handlers, and so on).
|
||
3. **File → Generate C++/GTK…** writes the `.ui`, `.h`, `.cpp`,
|
||
`Makefile`, and `CMakeLists.txt` for the window into a folder.
|
||
4. Build the generated project with either tool:
|
||
|
||
```sh
|
||
# Makefile path
|
||
g++ -o app *.cpp $(pkg-config --cflags --libs gtk+-3.0)
|
||
|
||
# CMake path
|
||
cmake -S . -B build && cmake --build build
|
||
```
|
||
|
||
5. Fill in the stub signal handlers in the generated `.cpp` and run `./app`.
|
||
|
||
**Debugger:** Debug → Open Debugger… runs any program compiled with `-g`.
|
||
Add a breakpoint as `file.cpp:123` or a function name, press Run, and step
|
||
through it. Breakpoints and debugger settings live under
|
||
`~/.config/lightgui/`.
|
||
|
||
## Tests
|
||
|
||
```sh
|
||
# Full test suite (needs xvfb for the GUI tests; xdotool optional)
|
||
./tests/run_matrix.sh
|
||
|
||
# Seam test: XFrame layout -> LightGUI project -> builds (make test)
|
||
make test
|
||
|
||
# Individual suites
|
||
./tests/widget_tests.sh
|
||
./tests/debugger_tests.sh
|
||
./tests/cmake_tests.sh
|
||
./tests/theme_tests.sh
|
||
./tests/palette_window_tests.sh
|
||
./tests/palette_icons_tests.sh
|
||
./tests/code_window_tests.sh
|
||
```
|
||
|
||
The palette self-test covers all 562 XFrame entries; the debugger
|
||
suite is 46 checks; the seam test maps all 562 widgets and verifies
|
||
the generated project builds.
|
||
|
||
## Layout of the repo
|
||
|
||
```
|
||
.
|
||
├── Makefile # the build (g++ + pkg-config gtk+-3.0)
|
||
├── install-*.sh # per-distro install scripts (see "Per-distro install scripts" above)
|
||
├── DESIGN.md # full design notes: widget mapping, model, phases
|
||
├── src/ # designer source (C++17, GTK C API, GtkBuilder)
|
||
│ ├── main.cpp # entry point, main window
|
||
│ ├── generator.cpp # C++/GTK code generation
|
||
│ ├── cmake_build.cpp # CMake build integration
|
||
│ ├── debugger.cpp # GDB/MI session backend
|
||
│ ├── debugger_ui.cpp # debugger window
|
||
│ ├── preferences.cpp # settings, themes, fonts
|
||
│ ├── codeview.cpp # generated-code viewer
|
||
│ ├── project_io.cpp # .fdj (JSON) project files
|
||
│ └── theme.cpp # color themes
|
||
├── ui/
|
||
│ └── designer.ui # main window layout (Glade)
|
||
├── ide # launcher script (not a binary): starts the
|
||
│ # full IDE — designer + XFrame palette + XFrame
|
||
│ # layout window. See "Build and run" above.
|
||
├── lightgui # the compiled designer binary (built by `make`);
|
||
│ # the designer alone, without the XFrame windows
|
||
├── widgets/ # the 562 XFrame widgets: components, core,
|
||
│ # common, palette, layout, tests, tools, icons
|
||
├── docs/ # IDE guide, widget reference, stock-market and
|
||
│ # instrumentation notes
|
||
├── tools/ # embed scripts, palette-icon generator
|
||
├── tests/ # unit + GUI test suites
|
||
├── icons/ # 16×16 palette icons, one per designer widget
|
||
└── screenshots/ # designer screenshots
|
||
```
|
||
|
||
See also the project site: [lightgui.com](https://www.lightgui.com).
|
||
|
||
## License
|
||
|
||
MIT — see [LICENSE](LICENSE). Copyright (c) 2026 cnmcdee.
|