18 Commits
Author SHA1 Message Date
Muse 81a9693d71 Fix monitor-widget proportions: dynamic graph margins, scaled fonts, tach numerals
- Graphs (History/Net/Temp): dynamic left margin from the widest Y
  label (fixes Y labels overflowing the plot), legend on top, 5 Y
  labels, humanised units in NetGraph, TempHistory threshold label
  above the line ("80 C limit"), top/bottom Y labels hang clear of
  the title and the strip below the plot. History gains -60s/now.
- XTachometer: numerals 7.5% of dial diameter bold just inside the
  tick ring, RPM bold centred in-dial below the top numerals (its
  baseline hangs below the top numeral so it cannot collide with
  the 3200/4800 numerals on small dials), readout "value (peak N)"
  enlarged below the hub, redline numerals in red.
- All 14 audit widgets: font sizes derived from widget dimensions
  per the proportions audit (titles 16px bold, hero values 24-48px
  bold, body/legend 13-16px, min 11px); CoreGrid keeps 4x2; UsageBar
  labels outside the bar on a dark panel; StackBar title+total
  header (adaptive: omitted at 48px where it would push the legend
  out) with centred block; VerticalBar value inside the bar, peak
  label with shrink-to-fit; ArcGauge centre 40-48px + endpoints;
  DonutGauge centre 36-44px, ring 8-10% of diameter, duplicate
  title dropped, centre label is the value name; ProcessList 13px
  rows, bold header with sort indicator, "N procs"; LoadBadge
  centred two-line block with scaled values; MonitorButton scaled
  label/dot/status + detail line; MonitorGrid ceil(sqrt(n)) columns,
  name+status+detail design with wrapped detail; SysBox hero
  28-32px + max + bar %.
- New _fpx() clamp helper; XStackBar gains the "unit" prop
  (props_monitor.py) for its "total <sum> <unit>" header.
- Demos: button/grid labels "SSH :22" -> "sshd :22", tach label
  "Engine" -> "RPM", stackbar demo 320x48 -> 320x120 (title+bar+
  legend cannot fit in 48px), verticalbar demo 60 -> 160 wide
  (the "peak 82" label cannot fit in a 60px widget).
- Deviations from the audit spec: UsageBar label capped at 40px
  (the literal 0.45x rule gives 209px in a 464px-tall bar); SysBox
  hero uses 10% of height clamped 20-32px (spec 6-7% conflicts
  with the audited-correct PY value of 10.3%); PY LoadBadge gets
  no 1/5/15 sub-labels (the audit calls the PY layout correct;
  the sub-labels were directed at Rust).
Full suite: 363 tests OK (44 skipped). All 15 demos shot + verified.
2026-12-05 21:32:36 +00:00
Muse b361a35909 Fix XStackBar legend: drop overlapping total text
The right-aligned total overlapped the last legend item and its
byte formatting was meaningless for unitless segments. Legend now
shows only the segment chips + percentages.
2026-12-05 17:09:23 +00:00
Muse cff0c74605 Fix gauge arcs: stray diagonal line; wall-time per-process CPU%
- Cairo arc() draws a connecting line from the current point to
  the arc start, and _wtext() leaves a current point (move_to +
  show_text), so the tachometer / arc / donut gauges grew a stray
  diagonal in the track color. New _arc_stroke() helper does
  new_path() before every arc.
- Tachometer digital readout moved below the hub (was colliding
  with the 0/max tick labels).
- XProcessList CPU% is now per-core against per-process wall
  time: on this VPS /proc/stat totals advance at only ~320
  jiffies/s for 8 cores (host vCPU scheduling), so the stat
  denominator inflated a busy loop to ~240%; wall time gives
  ~97% (verified live against a busy loop).
2026-12-05 17:07:19 +00:00
Muse 54c60188f0 X* monitor family (15 widgets): MonitorWidget + palette 547 -> 562
New btop-style live monitor widgets (registry 547-561, archetype
Monitor, family X, section Misc / X): XHistoryGraph, XCoreGrid,
XNetGraph, XTempHistory, XUsageBar, XStackBar, XVerticalBar,
XTachometer, XArcGauge, XDonutGauge, XProcessList, XLoadBadge,
XMonitorButton, XMonitorGrid, XSysBox. Drawn with Cairo on a
Gtk.DrawingArea like the rest of the set; sample data is runtime
state only (demo sine data until push()/refresh()/poll() feeds
real data). Checks are stdlib only: /proc scan, systemctl
is-active, socket to localhost. 35 new tests; full suite 363 green.
2026-12-05 16:48:47 +00:00
cnmcdee 3b67cbf9de Ind* indicators: CSV/series support on all 250 kinds
Transpile the C component ind_* function for every kind into
lightgui/xframe/indicators.py (tools/transpile_indicators.py), verified
250/250 against the C++ reference dump (<=1e-9, NaN patterns included).
IndicatorWidget gains the StockWidget series API (set_series, populate,
get_series, add_point, clear, load_csv, item_count, get_lines) and draws
the computed lines (14-colour palette, NaN gaps, dots for isolated
marker points) with the demo series as fallback. Docs in
docs/indicators-data.md; tests/test_indicators_csv.py (17 tests, golden
spot values vs the C++ reference); Xvfb shots via
tools/ind_csv_shots.py.
2026-12-02 11:04:35 +00:00
cnmcdee 11493b5f22 Stock charts: CSV data loading (load_csv/set_series/clear/populate)
Every chart widget rendered only the baked-in 250-bar demo series:
no set_series existed in Python despite the docstring naming it, so
there was no way to plot real data at all. Now StockWidget holds up
to three series slots (primary + two extra for the multi-symbol
charts) via set_series (the C API), get_series, add_point, clear /
populate, item_count, and load_csv; all 37 draw paths read the
widget series through _bars(widget) instead of module DEMO_SERIES,
so derived series (Heikin-Ashi, Renko, VWAP, OBV, ...) rebuild from
the loaded data and the drawing tools inherit it as background.

load_csv reads date,open,high,low,close,volume with the stdlib csv
module: header optional (matched by name, any order, extra columns
ignored), dates YYYY-MM-DD / YYYY/MM/DD / DD-MM-YYYY / ISO datetime
/ epoch seconds (validated, not stored -- the x-axis is bar index),
ValueError naming the row on bad data. A cleared series draws a
no-data placeholder; a one-bar series draws (Price: flat change).

Tests: tests/test_stock_csv.py, 27 tests (parsing, API, headless
renders of all 24 chart kinds incl. CSV-vs-template pixel diff).
Fixture tests/data/ohlcv_30.csv (30 weekday bars). Full suite 311
tests pass; visreg 24/24 stock charts pixel-identical to template
goldens. Docs: docs/stock-charts-data.md. Screenshots:
tools/stock_csv_shots.py (Xvfb, RMSE 9-35% vs template goldens).
2026-12-02 09:55:14 +00:00
cnmcdee 70165968b6 Task 3: TFontDialog height 340->420 (caption clipped) 2026-12-02 04:58:06 +00:00
cnmcdee a5e42fd100 Task 3: refine three placement minimums from live verification
TFontDialog height 320->340 (caption clipped), TOpenPictureDialog / TSavePictureDialog width 400->480 (filter string truncated). Same values as C.
2026-12-02 04:42:27 +00:00
cnmcdee 5a1ec47c6c Task 3: placement sizes are max(registry default, content minimum) so the outer border encloses each widget's content
27 widgets (18 dialogs, 2 calendars, 3 views, 4 choosers) get larger PaletteEntry defaults in lightgui/xframe/palette.py; canvas places at entry.default_w/default_h. New test Task3MinSizesTests asserts all 27; updated the AboutDialog size assertion in test_core.py. Full suite: 281 tests pass. Verified live under Xvfb: dialogs place at the new sizes (e.g. GtkAboutDialog 520x260). Two residual internal-layout collisions (TFindDialog Direction/Find Next, GtkFileChooserDialog Name/path) are draw-code issues, not placement size.
2026-12-02 04:31:38 +00:00
cnmcdee 5b0c6f02fd Single-placement mode + code-view sync on placement
Task 1: placing a widget now disarms placement mode — the next canvas
click places nothing until another palette widget is selected. Escape
and clicking the selected palette row again also cancel an armed
placement. Previously pending_kind persisted across placements, so
every click placed another fresh widget.

Task 2: placing a widget refreshes the Code window at once
(Lazarus-style) via a new CanvasState.on_placed hook wired to
Application.refresh_code_view(), so the generated code shows the new
widget without pressing Generate.

Tests: replaced test_pending_kind_persists_across_placements with
test_pending_kind_disarms_after_one_placement, plus
test_escape_cancels_pending_kind and
test_on_placed_fires_after_canvas_click_placement (280 tests pass).

Verified live under Xvfb (p-place-verify.sh + screenshots): place-once,
Escape-cancel, toggle-cancel, re-arm, code sync, clean app log.
2026-12-02 03:15:36 +00:00
cnmcdee 6eabe93b65 Phase 7 fix A+B: debugger labels above their panes; Inspector geometry refresh on programmatic resize
Fix A: the Breakpoints label sat below the breakpoint list, directly
above the Output label, and the two read as one cramped/overlapping
block at the bottom-left of the debugger window. It now sits above
its list (like Locals in the right pane) and the Output label has
6px top/start margins so it cannot crowd the middle pane.

Fix B: the Inspector only rebuilt on selection change, so a
programmatic resize (set_prop/resize_to/set_bounds) left the
geometry spins stale until the next selection, while canvas and
status bar already showed the new size. CanvasState now fires
on_bounds_change when the selected widget bounds move under the
same selection; the Inspector answers with refresh_geometry(),
which syncs just the four spins in place (no rebuild, no focus
loss). Handle drags fire the same hook, so drags keep working
and now track live.
2026-12-01 04:08:20 +00:00
cnmcdee 6d2dae20a1 Phase 6 fix: 14/16-segment maps + geometry verbatim from C
The draft segment code used its own segment ids (h/i centre
verticals, j/k/l/m diagonals) and drew diagonals as full-length
round-capped strokes, so I/K/M/V/W were wrong and every glyph was
swamped by a dark X blob ("HELLO" unreadable in the showcase
screenshot). This mirrors the C widgets exactly: segment_map()
strings from InstSeg14/16Display5.h, C ids (i/l centre verticals,
h/j/k/m diagonals), C draw_segment geometry (inset bars, hh/hv
verticals) and C draw_diag polygons that stop short of the centre.
Adds per-segment probe tests: every 14-seg glyph vs C map, 16-seg
M/W clean forms, 7-seg 8 vs 1.
2026-12-01 04:03:26 +00:00
cnmcdee 4333f72ed5 Phase 6: Stock (37) + Instrumentation (66) widgets -- drawing + property tables
Cairo drawings for all 103 kinds in lightgui/xframe/stock.py and
instruments.py (seeded 250-bar demo series so charts show their
colours with no series data; ddaf4bd anchor guard: ParallelChannel /
Pitchfork draw with 0-2 anchors; plot guard below 16px height).
Property tables generated by tools/gen_props_phase6.py from the C
Phase 4 tables (103 kinds, 1008 props, 116 distinct names; symbol
model-only; corrected up/down rgb(0,150,0)/rgb(200,30,30)).
Registry-name dispatch in core.lookup so kind-sharing entries
(IndVWAP/IndAnchoredVWAP kind VWAP, TArrow kind Arrow) keep their
own archetype drawings and generic-only tables.
2026-12-01 03:56:43 +00:00
cnmcdee 0cd61a3578 Phase 3: Object Inspector window + properties + font picker + bulk parameter
Inspector in its own window (LightGUI - Object Inspector, ~340px),
opened on startup beside the designer; closing hides it, palette
pane button reopens it. Scrolled grid: geometry spins, generic set,
custom props, Events group (OnClick etc. as editable text props,
stored as Event=handler in signals). Rows hexpand to fill the panel
width (b96e545/29751be fix); model-only rows flagged with *. Editors
by type: entry, spin -/+, checkbox, enum dropdown, colour entry +
Pick button, font-name entry + Pick button opening a
Gtk.FontChooserDialog (55daf32/6a7c4c7). Live-apply via set_prop.
Selection tracking via CanvasState.on_selection_change (fires only
when the selection moves, so typing never rebuilds the grid).
Bulk parameter (Set all / selected / filtered / Clear param) and
16-swatch colour palette (selected widget, or window background).
Canvas now paints project.background so a root swatch is visible.
Tests: 144 total, all pass under Xvfb.
2026-12-01 02:51:36 +00:00
cnmcdee 5692908b7b Phase 2 fix: calendar week numbers + tree expander
- Calendar: show-week-numbers now actually draws the ISO week
  numbers (44-49 for Nov 2026) in the left column; the column
  width was reserved but the numbers were never painted.
- TreeView: the expander triangle is only drawn on rows that have
  children (next row starts with path + "/"); leaf rows like
  "Other" no longer get a spurious triangle.
2026-12-01 02:44:56 +00:00
cnmcdee 7717194cbd Phase 2: faithful generic drawings + live-apply plumbing + tests
core.py: per-widget Cairo drawing inside the 14 archetypes, ported
from Rust archetypes.rs / C widget draws -- buttons (incl. link,
colour-swatch, lock, glyph, MenuButton direction arrow), toggles
(check/radio/switch/toggle-button/menu-check), labels (xalign/yalign,
wrap, accel stripping), entries (password masking, placeholder,
alignment, search/calc variants), text views (wrap modes, scrollbars,
cursor), ranges (scale with ticks/sel-range, scrollbar with thumb +
arrows, progress, spin, level bar), lists (combo, colour box, listbox,
checklistbox, tree, listview incl. icon style, menubar/menu, toolbar,
stack switcher), containers (frame/groupbox, notebook, calendar grid,
splitter, scrolled window, header/action bar, statusbar, window),
display (image scene, shape 0-9, separator, spinner, video,
drawing area), dialogs (title bar, file/color/about variants),
charts (line/bars/candles), spreadsheet grid. Drawings honour
background/foreground/border/font props; invisible draws nothing,
disabled dims. Pixel parity with C is NOT required.

Live-apply: Widget.set_prop validates against lightgui.props
(raises ValueError on unknown/bad/out-of-range props), updates
Name/geometry fields or props, marks the widget dirty and calls
on_change; CanvasState wires widget.on_change and clears dirty
after drawing. Widget setters: set_items (ComboBox/ListBox, prunes
CheckListBox checked-items), get/set_checked_items,
set_item_checked, set_password/set_show_password (masked until
revealed), set_direction (MenuButton), set_cursor_visible
(TextView), set_lower/set_page_increment (ScrollBar), set_value
(clamped), set_active, set_text (canonical caption prop).

model.py: caption seeding now uses the table's canonical prop
(label for Button/CheckBox, text for Entry); kinds with neither
get no seed.

tests: test_props.py (generic set on all 547 kinds, SS2.1-SS2.10
lists, validation, live-apply/dirty, setters, model-only flags)
and test_draw.py (headless Cairo smoke: every kind draws without
crashing and paints something; prop-driven branches). Five Phase 1
tests updated to the Phase 2 set_prop contract (label, not text,
for Button/Label; no arbitrary props). Full suite: 107 tests OK.
2026-12-01 02:42:21 +00:00
cnmcdee ff1cadbd80 Phase 1 fixes: import cairo for the draw signal, Gdk version, hint wrap
- canvas.py imports cairo so the draw signal marshalling works
  (needs python3-gi-cairo on the server; installed 3.56.2-1)
- app.py: gi.require_version Gdk + hint label wraps in the palette pane
- README: python3-gi-cairo is a required package
2026-12-01 02:28:36 +00:00
cnmcdee cef7988a84 Phase 1: XFrame core + canvas + palette data + project model
- xframe/core.py: Widget base, 14 archetype draw classes (Cairo),
  registry over all 547 kinds; 13px handles, 8px grab pad, 450ms
  double-click, 8px drag threshold, 24x16 resize floor (C/Rust)
- xframe/canvas.py: CanvasState state machine (display-free, tested)
  + Gtk.DrawingArea shell; placement, selection, double-click
  handles, drag, handle resize, Delete/Escape, viewport tracking
- xframe/palette.py: generated from Rust registry_gen.rs, cross-checked
  vs C xframe_palette.h; 547 entries in 11 sections + 36 legacy
  model.h type keys as LEGACY_TYPES (583 total in the Rust data file)
- model.py: Project + .fdj save/load byte-compatible with the C writer
- app.py: main window with filterable palette list + canvas + status bar
- tests/: 62 stdlib unittest tests
2026-12-01 02:23:54 +00:00