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.
148 lines
3.7 KiB
Python
148 lines
3.7 KiB
Python
"""Property tables for the X* monitor family (15 widgets).
|
|
|
|
Hand-written (there is no C source for these widgets to generate
|
|
from): each kind's own props below, registered with
|
|
register_custom_table -- the same hook Phase 6 uses for the Stock /
|
|
Instrumentation families. Generic set first (from
|
|
lightgui.props.props_for), then each widget's own props. Every prop
|
|
here is honoured by the draw code in lightgui/xframe/monitor.py
|
|
and live-applies; none is model-only.
|
|
"""
|
|
|
|
from lightgui.props import PropDef, register_custom_table
|
|
|
|
|
|
def _label(default=""):
|
|
return PropDef("label", "Str", default, 0, 0, (), (),
|
|
"Caption", False)
|
|
|
|
|
|
def _value(default="0"):
|
|
return PropDef("value", "Double", default, 0, 0, (), (),
|
|
"Value", False)
|
|
|
|
|
|
def _minimum(default="0"):
|
|
return PropDef("minimum", "Double", default, 0, 0, (), (),
|
|
"Minimum", False)
|
|
|
|
|
|
def _maximum(default="100"):
|
|
return PropDef("maximum", "Double", default, 0, 0, (), (),
|
|
"Maximum", False)
|
|
|
|
|
|
def _window(default="60"):
|
|
return PropDef("window", "Int", default, 0, 0, (), (),
|
|
"Window", False)
|
|
|
|
|
|
def _unit(default=""):
|
|
return PropDef("unit", "Str", default, 0, 0, (), (), "Unit", False)
|
|
|
|
|
|
# kind (registry name) -> custom props.
|
|
MONITOR_TABLES = {
|
|
"XHistoryGraph": (
|
|
_label(),
|
|
_window(),
|
|
_minimum(),
|
|
_maximum(),
|
|
PropDef("series-count", "Int", "2", 0, 0, (), (),
|
|
"SeriesCount", False),
|
|
PropDef("series-names", "Str", "", 0, 0, (), (),
|
|
"SeriesNames", False),
|
|
PropDef("show-legend", "Bool", "true", 0, 0, (), (),
|
|
"ShowLegend", False),
|
|
),
|
|
"XCoreGrid": (
|
|
_label(),
|
|
_window(),
|
|
PropDef("cores", "Int", "0", 0, 0, (), (),
|
|
"Cores", False),
|
|
),
|
|
"XNetGraph": (
|
|
_label(),
|
|
_window(),
|
|
),
|
|
"XTempHistory": (
|
|
_label(),
|
|
_window(),
|
|
_minimum(),
|
|
_maximum(),
|
|
PropDef("threshold", "Double", "80", 0, 0, (), (),
|
|
"Threshold", False),
|
|
),
|
|
"XUsageBar": (
|
|
_label(),
|
|
_value(),
|
|
_minimum(),
|
|
_maximum(),
|
|
),
|
|
"XStackBar": (
|
|
_label(),
|
|
PropDef("segments", "Str", "", 0, 0, (), (),
|
|
"Segments", False),
|
|
),
|
|
"XVerticalBar": (
|
|
_label(),
|
|
_value(),
|
|
_minimum(),
|
|
_maximum(),
|
|
),
|
|
"XTachometer": (
|
|
_label(),
|
|
_value(),
|
|
_minimum(),
|
|
_maximum("8000"),
|
|
PropDef("redline", "Double", "6400", 0, 0, (), (),
|
|
"Redline", False),
|
|
_unit(),
|
|
),
|
|
"XArcGauge": (
|
|
_label(),
|
|
_value(),
|
|
_minimum(),
|
|
_maximum(),
|
|
_unit("usage"),
|
|
),
|
|
"XDonutGauge": (
|
|
_label(),
|
|
_value(),
|
|
_minimum(),
|
|
_maximum(),
|
|
_unit(),
|
|
),
|
|
"XProcessList": (
|
|
_label(),
|
|
PropDef("sort-by", "Enum", "0", 0, 0,
|
|
("CPU", "Memory", "PID", "Name"), (0, 1, 2, 3),
|
|
"SortBy", False),
|
|
PropDef("sort-desc", "Bool", "true", 0, 0, (), (),
|
|
"SortDesc", False),
|
|
),
|
|
"XLoadBadge": (
|
|
_label(),
|
|
),
|
|
"XMonitorButton": (
|
|
_label(),
|
|
PropDef("check-type", "Enum", "0", 0, 0,
|
|
("Process", "Unit", "Port"), (0, 1, 2),
|
|
"CheckType", False),
|
|
PropDef("target", "Str", "", 0, 0, (), (), "Target", False),
|
|
),
|
|
"XMonitorGrid": (
|
|
_label(),
|
|
),
|
|
"XSysBox": (
|
|
_label(),
|
|
_value(),
|
|
_minimum(),
|
|
_maximum(),
|
|
_unit("%"),
|
|
),
|
|
}
|
|
|
|
for _kind, _props in MONITOR_TABLES.items():
|
|
register_custom_table(_kind, _props)
|