Author SHA1 Message Date
Muse 53429a87e6 Inst*: proportions fix (audit Dec 2026) — buttons, switches, panels
Rocker I ON / O OFF (UP / DOWN double) 16 px bold, illuminated
lamp window scaled with ON/OFF inside; toggle/slide state 16 px
bold, slide knob bigger with grip; rotary numerals 16 px bold +
POS n / N readout inside the plate; push-button face label white
on the coloured face 18 px bold with title at the foot; E-STOP
white on red 18 px bold on the mushroom; breaker ON 16 px bold;
bezel GAUGE 14-16 px; panel/control headers taller with 18-20 px
bold titles, grid labels 14 px bold. Drive-bys found while
shooting: _color now falls back to the per-kind PropDef default
(LedBlue/PanelLampBlue rendered red); Rotary plate arc joined a
stray chord from the last numeral (cr.new_path before arc).
2026-12-05 22:53:17 +00:00
Muse 34ff1da9e7 Inst*: proportions fix (audit Dec 2026) — lamps + LEDs
LED block scales with the widget; label 12-15% of LED diameter
bold with leads ending above it; panel-lamp disc shrunk so the
16-18 px bold label clears below it; RGB swatches 24 px with 14 px
R/G/B labels; Beacon bar lowered, dome clear of it, FLASH rate in
white on the bar, BEACON 16 px bold below; StackLight title 16 px
bold plus R/A/G segment letters 24 px bold, white on lit / light
grey on unlit; LampTestButton text 16 px bold. Default word labels
via _label() (C constructor defaults, G2).
2026-12-05 22:45:07 +00:00
Muse 80a1698f7a Inst*: proportions fix (audit Dec 2026) — worst offenders + level gauges
Seg14/16 + LedDigits fill widget (dark face so dim segments read
faint, diagonals thinned); DigitalReadout off-segments slightly
more visible; dial numerals 7-8% of diameter bold just inside the
tick ring with titles inside below top numerals; NeedleVu numerals
4% of width bold, red in red zone, VU below arc centre; tank scale
16 / alarms 14 bold / % 18 bold with clearance; horizontal tank
capsule ends inside widget with alarm labels above; sight-glass
tube widened; KeySwitch NO KEY light-on-dark with position
numerals, slot at the current position; Nameplate engraving fit to
45% of plate width. Scaled-font helpers _cap_size/_fs/_fit_size
(cap-height convention, as C inst_cap_font).
2026-12-05 22:43:12 +00:00
5 changed files with 496 additions and 320 deletions

No files matched your search

-30
View File
@@ -1,30 +0,0 @@
# CPU Dashboard — monitor (Python)
A btop-style CPU dashboard in one 1024x768 window, built only from
LightGUI XFrame monitor widgets:
- **XCoreGrid** — per-core mini history graphs
- **XTachometer** — big total-CPU % gauge (redline 80%)
- **XHistoryGraph** — total CPU % over the last 60 s
- **XLoadBadge** — load average 1/5/15 min + uptime
- **XUsageBar** — total CPU % bar
Live data comes from `/proc/stat` (per-core busy %, via
`XCoreGrid.refresh_cores()`) and `/proc/loadavg` (via
`XLoadBadge.refresh_load()`), sampled every 500 ms. Pushing live
samples starts fresh series, so the deterministic demo data is
replaced on the first live sample.
## Run
```sh
PYTHONPATH=. python3 examples/monitor_cpu_dashboard/main.py
```
Esc, `q`, or closing the window quits.
## Source
- App: `examples/monitor_cpu_dashboard/main.py`
- Widgets: `lightgui/xframe/monitor.py`
- Repo: https://github.com/cnmcdee/lightgui_python
-138
View File
@@ -1,138 +0,0 @@
#!/usr/bin/env python3
"""CPU Dashboard - monitor (Python).
A btop-style CPU dashboard in one 1024x768 window, built only from
LightGUI XFrame monitor widgets (XCoreGrid, XTachometer,
XHistoryGraph, XLoadBadge, XUsageBar). Live data from /proc/stat
(per-core busy %, via XCoreGrid.refresh_cores()) and /proc/loadavg
(via XLoadBadge.refresh_load()), sampled every 500 ms. The
deterministic demo data each widget draws with no data pushed is
replaced on the first live sample: push() / push_core() start fresh
series, and the histories are primed with the first live value.
Run with:
PYTHONPATH=/root/monitor-wt/cpu-dashboard/lightgui_python python3 \\
examples/monitor_cpu_dashboard/main.py
(or from the repo root with PYTHONPATH=. )
"""
import gi
gi.require_version("Gtk", "3.0")
gi.require_version("Gdk", "3.0")
from gi.repository import Gdk, GLib, Gtk # noqa: E402
from lightgui.xframe.core import create, parse_color # noqa: E402
_TITLE = "CPU Dashboard - monitor"
_DESIGN_SIZE = (1024, 768)
_BACKGROUND = ""
_WIDGETS = []
_AREA = []
_PRIMED = [False]
def _build_widgets():
"""Create every placed widget with its props."""
widgets = []
badge = create("XLoadBadge", "LoadBadge_001", 16, 16, 320, 84)
badge.set_prop("label", "Load avg")
badge.refresh_load()
widgets.append(badge)
bar = create("XUsageBar", "UsageBar_001", 352, 16, 656, 84)
bar.set_prop("label", "Total CPU")
bar.set_prop("minimum", "0")
bar.set_prop("maximum", "100")
widgets.append(bar)
grid = create("XCoreGrid", "CoreGrid_001", 16, 116, 640, 300)
grid.set_prop("label", "CPU cores")
grid.set_prop("cores", "8")
widgets.append(grid)
tacho = create("XTachometer", "Tachometer_001", 672, 116, 336, 300)
tacho.set_prop("label", "CPU %")
tacho.set_prop("minimum", "0")
tacho.set_prop("maximum", "100")
tacho.set_prop("redline", "80")
tacho.set_prop("unit", "%")
widgets.append(tacho)
hist = create("XHistoryGraph", "HistoryGraph_001", 16, 432, 992, 320)
hist.set_prop("label", "Total CPU history")
hist.set_prop("window", "60")
hist.set_prop("minimum", "0")
hist.set_prop("maximum", "100")
hist.set_prop("series-names", "CPU")
widgets.append(hist)
return widgets
def _tick():
"""500 ms tick: feed live samples, then redraw."""
badge, bar, grid, tacho, hist = _WIDGETS
values = grid.refresh_cores()
if values:
total = sum(values) / len(values)
if not _PRIMED[0]:
# First live sample: prime the histories with it so no
# seeded demo data is visible (60 = window capacity).
for core, value in enumerate(values):
for _ in range(59):
grid.push_core(core, value)
for _ in range(60):
hist.push(total)
_PRIMED[0] = True
else:
hist.push(total)
tacho.set_value(total)
bar.set_value(total)
badge.refresh_load()
if _AREA:
_AREA[0].queue_draw()
return True
def _on_draw(area, cr):
bg = parse_color(_BACKGROUND, None)
if bg is None:
bg = (1.0, 1.0, 1.0)
cr.set_source_rgb(*bg)
cr.paint()
for widget in _WIDGETS:
widget.draw(cr)
return False
def _on_key_press(window, event):
if event.keyval in (Gdk.KEY_Escape, Gdk.KEY_q):
Gtk.main_quit()
return True
return False
def main():
window = Gtk.Window(title=_TITLE)
window.set_default_size(*_DESIGN_SIZE)
window.set_resizable(False)
window.connect("destroy", Gtk.main_quit)
window.connect("key-press-event", _on_key_press)
area = Gtk.DrawingArea()
area.set_hexpand(True)
area.set_vexpand(True)
area.connect("draw", _on_draw)
window.add(area)
_WIDGETS.extend(_build_widgets())
_AREA.append(area)
GLib.timeout_add(500, _tick)
window.show_all()
Gtk.main()
return 0
if __name__ == "__main__":
import sys
sys.exit(main())
Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

File diff suppressed because it is too large. Load diff
-1
View File
@@ -1193,7 +1193,6 @@ class MonitorWidget(Widget):
ly = cy + (r - 26) * math.sin(ang) + 3
_wtext(cr, self, label, lx, ly, size=9, rgb=_TEXT,
align="center")
cr.restore()
# Peak-hold tick.
cr.save()
_rgb(cr, _WHITE)