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
4 changed files with 496 additions and 337 deletions

No files matched your search

@@ -1,55 +0,0 @@
# Service Dashboard — monitor app (Python)
A service/port dashboard in one window (1024×768): a single
`XMonitorGrid` of illuminator buttons for the services that actually
run on this host (hot_dallas). Each button polls its live check every
2 seconds and glows green when up, red when down, dim when unknown.
Click anywhere on the grid to re-poll every cell now.
## What it monitors
| Button | Kind | Check |
| --- | --- | --- |
| SSH :22 | Port | TCP connect to localhost:22 |
| HTTP :80 | Port | TCP connect to localhost:80 (nginx) |
| HTTPS :443 | Port | TCP connect to localhost:443 (nginx) |
| NPM admin :81 | Port | TCP connect to localhost:81 |
| ThinkMelt :2368 | Port | TCP connect to localhost:2368 |
| Ghost :5000 | Port | TCP connect to localhost:5000 |
| lightgui.com :5009 | Port | TCP connect to localhost:5009 |
| Traffic stats :7888 | Port | TCP connect to localhost:7888 (GoAccess) |
| dockerd | Process | `/proc/<pid>/comm` == `dockerd` |
| containerd | Process | `/proc/<pid>/comm` == `containerd` |
| docker.service | Unit | `systemctl is-active docker.service` == `active` |
| ssh.service | Unit | `systemctl is-active ssh.service` == `active` |
No mock or static data: every cell is a live `XMonitorButton` check
(`poll_all()` on a 2 s `GLib.timeout_add` timer).
## Widgets used
- `XMonitorGrid` — the panel; one shared `poll_all()` timer.
- `XMonitorButton` — one cell per service (kinds port / process /
unit, via `set_monitors`).
## Build and run
```sh
# from the lightgui_python checkout
PYTHONPATH=/root/monitor-wt/service-dashboard/lightgui_python python3 examples/monitor_service_dashboard/main.py
```
## Tests
```sh
DISPLAY=:99 python3 -m unittest discover -s tests
```
## Source
- Python: `examples/monitor_service_dashboard/main.py` in
[lightgui_python](https://github.com/cnmcdee/lightgui_python)
- C++: `examples/monitor/service-dashboard/main.cpp` in
[lightgui](https://github.com/cnmcdee/lightgui)
- Rust: `crates/xframe-demo/examples/monitor_service_dashboard/main.rs`
in [lightgui_rust](https://github.com/cnmcdee/lightgui_rust)
-131
View File
@@ -1,131 +0,0 @@
#!/usr/bin/env python3
"""Service Dashboard -- monitor app.
One 1024x768 window holding a single XMonitorGrid of illuminator
buttons for the services that actually run on this host
(hot_dallas): TCP ports (sshd, nginx, NPM, ThinkMelt, Ghost blogs,
traffic stats), processes (dockerd, containerd) and systemd units
(docker.service, ssh.service). Every cell is a live check, re-polled
on a shared 2 s timer; green when up, red when down. Click a cell
to re-check it now.
Run with the LightGUI Python package on PYTHONPATH:
PYTHONPATH=/root/monitor-wt/service-dashboard/lightgui_python python3 examples/monitor_service_dashboard/main.py
"""
import sys
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
# (check_type, target, label) -- check_type is "port" (TCP connect to
# localhost), "process" (/proc/<pid>/comm match) or "unit"
# (systemctl is-active == active). All of these run on this host.
SERVICES = [
("port", "22", "SSH :22"),
("port", "80", "HTTP :80"),
("port", "443", "HTTPS :443"),
("port", "81", "NPM admin :81"),
("port", "2368", "ThinkMelt :2368"),
("port", "5000", "Ghost :5000"),
("port", "5009", "lightgui.com :5009"),
("port", "7888", "Traffic stats :7888"),
("process", "dockerd", "dockerd"),
("process", "containerd", "containerd"),
("unit", "docker.service", "docker.service"),
("unit", "ssh.service", "ssh.service"),
]
_DESIGN_SIZE = (1024, 768)
_BACKGROUND = ""
_WIDGETS = []
_LAST_SIZE = [None]
_AREA = []
def _build_widgets():
"""Create the grid and wire the real services (no demo data)."""
widgets = []
widget = create("XMonitorGrid", "ServiceGrid_001", 16, 16, 992, 736)
widget.set_prop("label", "Services -- hot_dallas")
# set_monitors replaces the grid cells wholesale (the widget
# starts with none); each cell is a live XMonitorButton check.
widget.set_monitors(SERVICES)
widget.poll_all()
widgets.append(widget)
return widgets
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_button_press(area, event):
# Click anywhere on the grid re-polls every cell now (the grid
# has no per-cell click API in Python; the 2 s timer does the
# same check anyway).
for widget in _WIDGETS:
widget.poll_all()
area.queue_draw()
return False
def _on_area_resize(area, allocation):
size = (allocation.width, allocation.height)
if size == _LAST_SIZE[0]:
return False
_LAST_SIZE[0] = size
for widget in _WIDGETS:
widget.move_to(16, 16)
widget.resize_to(max(100, size[0] - 32), max(100, size[1] - 32))
area.queue_draw()
return False
def _tick():
"""Shared 2 s poll: re-check every cell, then redraw."""
for widget in _WIDGETS:
widget.poll_all()
if _AREA:
_AREA[0].queue_draw()
return True
def main():
window = Gtk.Window(title="Service Dashboard - monitor")
window.set_default_size(1024, 768)
window.connect("destroy", Gtk.main_quit)
vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=0)
window.add(vbox)
area = Gtk.DrawingArea()
area.set_hexpand(True)
area.set_vexpand(True)
area.add_events(
Gdk.EventMask.BUTTON_PRESS_MASK | Gdk.EventMask.BUTTON_RELEASE_MASK
)
area.connect("draw", _on_draw)
area.connect("button-press-event", _on_button_press)
area.connect("size-allocate", _on_area_resize)
vbox.pack_start(area, True, True, 0)
_WIDGETS.extend(_build_widgets())
_AREA.append(area)
GLib.timeout_add(2000, _tick)
window.show_all()
Gtk.main()
return 0
if __name__ == "__main__":
sys.exit(main())
Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

File diff suppressed because it is too large. Load diff