plesty.lib.ui.monitor_panel

The panel that shows a live view: the bridge from monitors to the shell.

MonitorPanel is the one place where the two halves meet — a Monitor (what to draw) and a Shell sub-window (where to draw it). Building the panel attaches a renderer to the monitor, and the shell’s clock drives pump(), so nothing else in the application has to poll.

from plesty.lib.monitor import RunSource
from plesty.lib.ui import MonitorPanel, run

source = RunSource(run_dir, mapper=to_channels)
run([MonitorPanel(SpectrumMonitor(source), area="top")], title="QD-FSS")

Classes

MonitorPanel

Sub-window rendering one monitor.

Module Contents

class plesty.lib.ui.monitor_panel.MonitorPanel(monitor: plesty.lib.monitor.base_monitor.Monitor, *, theme: plesty.lib.ui.theme.Theme | None = None, **kwargs: Any)

Bases: plesty.lib.ui.panel.Panel

Sub-window rendering one monitor.

The panel is toolkit-free until it is built: constructing and describing it needs no GUI, which is what lets a headless test cover a shell’s composition.

Wrap monitor into a dockable panel.

Parameters:
kind: ClassVar[str] = 'monitor'

Panel category, used for layout keys and styling hooks.

monitor
theme = None
renderer: Any = None
build(parent: Any = None) Any

Create the plot widget and attach it to the monitor.

Parameters:

parent (Any) – The parent widget provided by the shell.

Returns:

The plot widget.

Return type:

Any

tick() None

Drain the monitor’s source; every new frame redraws immediately.

Return type:

None

status() str

Return the monitor’s status line.

Returns:

The text the monitor wants shown in the title bar.

Return type:

str

close() None

Detach the renderer and close the monitor’s source.

Return type:

None

describe() dict[str, Any]

Return the panel description including the monitor it shows.

Returns:

The panel’s placement plus describe().

Return type:

dict[str, Any]