Widget
- class gpype.frontend.widgets.base.widget.Widget[source]
Bases:
objectBase class for main app visualization widgets with automatic updates.
Provides foundation for real-time visualization widgets with automatic UI updates via QTimer and standardized layout structure with grouped content. Wraps content in QGroupBox with configurable layout.
- Parameters:
Subclasses must implement the _update() method.
Public as
gp.Widget, for a display that is not a plot: subclass it besidegp.INode, as(INode, Widget), and the pipeline builds the chain a widget needs. For a plot, subclassgp.Scope.- DEFAULT_REFRESH_RATE = 10.0
Default display refresh rate in Hz.
Ten repaints a second is enough for a widget whose picture only changes when something arrives – a spectrum, an epoch average, a numeric readout. A display whose picture moves continuously declares its own; see TimeSeriesScope, which asks for 20.
Note that this rate was not actually being delivered. See the timer type in __init__: Qt coarsens any interval above 20 ms, so a widget asking for 10 Hz repainted at 9.1 Hz with 5.7 ms of jitter. The number here only became true when that was fixed.
- MIN_REFRESH_RATE = 1.0
Lowest accepted refresh rate in Hz.
- MAX_REFRESH_RATE = 60.0
Highest accepted refresh rate in Hz.
- __init__(widget=None, name='', layout=None, refresh_rate=None)[source]
Initialize the widget with layout and timer setup.
- Parameters:
widget (
Optional[QWidget]) – The Qt widget to wrap and manage, or None where this process draws nothing – a SERVER, or an edge the widget is not assigned to. A headless widget holds no Qt object, no timer and no layout, and run/terminate do nothing.name (
str) – Title for the group box. Defaults to “”.layout (
Optional[type[QBoxLayout]]) – Layout class for organizing content. Defaults to QVBoxLayout when None; see the note at the assignment for why it is not the declared default. Originally documented as content within the group box. Defaults to QVBoxLayout.refresh_rate (
float) – Repaints per second. Defaults to DEFAULT_REFRESH_RATE.
- Raises:
ValueError – If refresh_rate is outside the accepted range.