New Archetype::Monitor (MonitorWidget, kind-dispatched draw) for XHistoryGraph, XCoreGrid, XNetGraph, XTempHistory, XUsageBar, XStackBar, XVerticalBar, XTachometer, XArcGauge, XDonutGauge, XProcessList, XLoadBadge, XMonitorButton, XMonitorGrid, XSysBox. - data/registry.json + data/palette.json: 15 entries, registry kept in sorted order (the C extractor requires it); palette Misc/X group re-sorted, other sections untouched, registry_index refreshed (XGraph 545->548, XSpreadsheet 546->555). - crates/xframe-widgets/src/monitor.rs: stdlib-only live checks (/proc scan, systemctl is-active, TcpStream::connect_timeout), poll()/update() with a 2s staleness guard, deterministic demo seeding; unit tests incl. headless Canvas draw for all kinds. - Placeholder 16x16 icons (assets/PROVENANCE.md notes they are placeholders pending the C port) + 15 demo examples + README monitor-family section (547 -> 562). - xframe-common ico test tolerates the 15 monitor icons as pending until the C icons land (matched by name, not index). cargo build --workspace: clean, warning-free. xframe-common lib 8/8, xframe-widgets lib 28/28, widget_tests 24/24, demo smoke 3/3, designer palette/seam 4/4 + 4/4 pass.
67 lines
4.0 KiB
Markdown
67 lines
4.0 KiB
Markdown
# lightgui_rust — LightGUI ported to Rust
|
||
|
||
Rust port of [LightGUI](https://github.com/cnmcdee/lightgui)
|
||
(HEAD `eb0b5fc`): an XFrame-native form designer with 562 XFrame widgets.
|
||
See `PORTING_PLAN.md` for the survey and module map.
|
||
|
||
## Workspace
|
||
|
||
| Crate | C++ source | Status |
|
||
|---|---|---|
|
||
| `crates/lightgui-core` | `src/model.h`, `src/props.h`, `src/events.h`, `src/project_io.cpp`, `canonicalize()` in `src/main.cpp` | done |
|
||
| `crates/lightgui-gen` | `src/generator.cpp` / `src/generator.h` (emits C++/XFrame, byte-identical) | done |
|
||
| `crates/lightgui-debug` | `src/debugger.cpp` / `src/debugger.h` (GDB/MI) | in progress |
|
||
| `crates/lightgui-support` | data extraction (registry, palette, indicators) | in progress |
|
||
|
||
`probe/` is the step-0 crates.io probe (standalone, excluded from the
|
||
workspace). `data/` / `tools/` are generated data + extraction tooling.
|
||
|
||
## Build / test
|
||
|
||
```sh
|
||
cargo test # workspace; rustc/cargo are login-shell-only: use `bash -lc`
|
||
cargo build # must be warning-free (the C++ build was zero-warning)
|
||
```
|
||
|
||
Rust 1.100.1 stable, GTK 3.24 (gtk-rs 0.18), serde/serde_json 1.0.
|
||
|
||
## Monitor widgets (X*)
|
||
|
||
The 15 btop-family monitor widgets (registry 547–561, family `X`,
|
||
section `Misc / X`) live in `crates/xframe-widgets/src/monitor.rs`
|
||
(one `MonitorWidget` struct, kind-dispatched like `InstrumentWidget`,
|
||
new `Archetype::Monitor`). They draw with raw X11 via `DrawTarget`
|
||
only — no GTK calls inside the widgets — and their live checks use
|
||
the standard library only (`/proc` scans, `systemctl is-active`,
|
||
`TcpStream::connect_timeout`); no new dependencies.
|
||
|
||
| Widget | What it shows | Example |
|
||
|---|---|---|
|
||
| `XHistoryGraph` | Scrolling multi-series time-series graph, 60 s window, cur/min/max/avg legend | `cargo run -p xframe-demo --example XHistoryGraph` |
|
||
| `XCoreGrid` | One mini history graph per CPU core, label + current % each | `cargo run -p xframe-demo --example XCoreGrid` |
|
||
| `XNetGraph` | Dual up/down scrolling graph, current rates + byte totals | `cargo run -p xframe-demo --example XNetGraph` |
|
||
| `XTempHistory` | Temperature history with threshold line + over-temp colouring | `cargo run -p xframe-demo --example XTempHistory` |
|
||
| `XUsageBar` | Horizontal gradient usage bar with label + % text | `cargo run -p xframe-demo --example XUsageBar` |
|
||
| `XStackBar` | Stacked multi-segment bar (used/cached/buffers/free) + legend | `cargo run -p xframe-demo --example XStackBar` |
|
||
| `XVerticalBar` | Vertical bar meter with scale + peak-hold marker | `cargo run -p xframe-demo --example XVerticalBar` |
|
||
| `XTachometer` | Round tachometer: needle, redline zone, digital readout, peak hold | `cargo run -p xframe-demo --example XTachometer` |
|
||
| `XArcGauge` | Semicircular arc gauge, coloured zones, big % in the middle | `cargo run -p xframe-demo --example XArcGauge` |
|
||
| `XDonutGauge` | Circular progress ring with % centred | `cargo run -p xframe-demo --example XDonutGauge` |
|
||
| `XProcessList` | Live process table from `/proc`: sortable columns, in-cell CPU% bars | `cargo run -p xframe-demo --example XProcessList` |
|
||
| `XLoadBadge` | Load averages (1/5/15 min) with colour thresholds + uptime | `cargo run -p xframe-demo --example XLoadBadge` |
|
||
| `XMonitorButton` | A button that is a live monitor: process / systemd unit / TCP port | `cargo run -p xframe-demo --example XMonitorButton` |
|
||
| `XMonitorGrid` | Panel of `XMonitorButton`s in a labelled grid, one shared poll timer | `cargo run -p xframe-demo --example XMonitorGrid` |
|
||
| `XSysBox` | Composite resource box: title + big number + history graph + usage bar | `cargo run -p xframe-demo --example XSysBox` |
|
||
|
||
History widgets are seeded with deterministic demo series; a host app
|
||
feeds live samples with `MonitorWidget::push_samples` / `push_value`.
|
||
`XProcessList`, `XLoadBadge`, `XMonitorButton` and `XMonitorGrid` pull
|
||
live state in the constructor and re-poll through
|
||
`MonitorWidget::poll` / `update` / `poll_all` on the host's timer
|
||
(the demo runner has no periodic timer hook).
|
||
|
||
## Docs
|
||
|
||
- `docs/stock-charts-csv.md` — how the stock chart widgets ingest
|
||
plotting data (CSV format, per-kind series, clear/populate, limits).
|