Commit Graph
8 Commits
Author SHA1 Message Date
Muse 2d52b55743 Examples + shots: XHistoryGraph, XCoreGrid, XNetGraph, XTempHistory, XUsageBar
Designer-pattern examples (xgraph.py harness + live-demo GLib timer
feeding seeded/live sine data). Screenshots under Xvfb :107 via
tools/shoot_monitor.py (xdotool + import, PIL non-blank check).
2026-12-05 17:07:40 +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 bfb366c083 Add visual regression harness for all 547 widgets
tools/visreg/run.sh re-renders every widget example the same way the
pythondoc sweep did (Xvfb, import -window root, crop to window size),
diffs each shot against its golden with ImageMagick RMSE (normalized,
0.5% threshold), and writes out/report.md + report.json with per-widget
PASS/FAIL and diff percentages. Goldens vendored from the pythondoc
sweep shots. Full run on a clean tree: 547/547 PASS, max diff 0.0%.
2026-12-02 09:10:45 +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 caaebd9608 Phase 4: rename tooltip-text display to Tooltip (was a second Hint row) 2026-12-01 03:05:58 +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 eeccee6c9a Phase 2: property tables (props.py) generated from C props.h
- tools/gen_props.py parses /opt/lightgui/src/props.h (common_props +
  props_for tables, enum labels/values) and the 547-kind palette,
  emitting lightgui/props.py; REQUIRED spot-checks enforce the
  proposal SS2.1-SS2.10 lists against the C tables.
- Every kind gets the 43-prop generic set (Name, geometry, Color,
  Font Name/Size/Color/Style, Border, Enabled, Visible, Hint,
  ShowHint, Cursor, TabOrder, TabStop, Constraints, BorderSpacing,
  AutoSize, Tag, Align, Anchors); 38 family custom tables cover the
  generic widgets. Stock/Instrumentation get the generic set only
  (Phase 6 adds theirs via register_custom_table()).
- Lazarus display names + model_only flags (stored, generator
  comments, no live canvas effect); validate() canonicalises
  bool/int/double/enum/color or raises ValueError.
2026-12-01 02:35:39 +00:00