Display

Unified monitor & control widget

Displays sensor values, and can optionally control system settings.

The PVP_Gui instantiates display widgets according to the contents of values.DISPLAY_CONTROL and values.DISPLAY_MONITOR

Classes:

Display(value[, update_period, enum_name, ...])

Unified widget for display of sensor values and control of ventilation parameters

Limits_Plot([style])

Widget to display current value in a bar graph along with alarm limits

class pvp.gui.widgets.display.Display(value: pvp.common.values.Value, update_period: float = 0.5, enum_name: Optional[pvp.common.values.ValueName] = None, button_orientation: str = 'left', control_type: Union[None, str] = None, style: str = 'dark', *args, **kwargs)[source]

Unified widget for display of sensor values and control of ventilation parameters

Displayed values are updated according to Dispaly.timed_update()

Parameters
  • value (Value) – Value object to represent

  • update_period (float) – Amount of time between updates of the textual display of values

  • enum_name (ValueName) – Value name of object to represent

  • button_orientation ('left', 'right') – whether the controls are drawn on the 'left' or 'right'

  • control_type (None, 'slider', 'record') – type of control - either None (no control), slider (a slider can be opened to set a value), or record where recent sensor values are averaged and used to set the control value. Both types of control allow values to be input from the keyboard by clicking on the editable label

  • style ('light', 'dark') – whether the widget is 'dark' (light text on dark background) or 'light' (dark text on light background

  • **kwargs (*args,) –

    passed on to PySide2.QtWidgets.QWidget

self.name

Unpacked from value

self.units

Unpacked from value

self.abs_range

Unpacked from value

self.safe_range

Unpacked from value

self.alarm_range

initialized from value, but updated by alarm manager

self.decimals

Unpacked from value

self.update_period

Amount of time between updates of the textual display of values

Type

float

self.enum_name

Value name of object to represent

Type

ValueName

self.orientation

whether the controls are drawn on the 'left' or 'right'

Type

‘left’, ‘right’

self.control

type of control - either None (no control), slider (a slider can be opened to set a value), or record where recent sensor values are averaged and used to set the control value.

Type

None, ‘slider’, ‘record’

self._style

whether the widget is 'dark' (light text on dark background) or 'light' (dark text on light background)

Type

‘light’, ‘dark’

self.set_value

current set value of controlled value, if any

Type

float

self.sensor_value

current value of displayed sensor value, if any.

Type

float

Attributes:

value_changed(*args, **kwargs)

Signal emitted when controlled value of display object has changed.

is_set

Check if value has been set for this control.

alarm_state

Current visual display of alarm severity

staticMetaObject

Methods:

init_ui()

UI is initialized in several stages

init_ui_labels()

init_ui_toggle_button()

init_ui_limits()

Create widgets to display sensed value alongside set value

init_ui_slider()

init_ui_record()

init_ui_layout()

Basically two methods.

init_ui_signals()

toggle_control(state)

Toggle the appearance of the slider, if a slider

toggle_record(state)

Toggle the recording state, if a recording control

_value_changed(new_value)

"outward-directed" method to emit new changed control value when changed by this widget

update_set_value(new_value)

Update to reflect new control value set from elsewhere (inwardly directed setter)

update_sensor_value(new_value)

Receive new sensor value and update display widgets

update_limits(control)

Update the alarm range and the GUI elements corresponding to it

redraw()

Redraw all graphical elements to ensure internal model matches view

timed_update()

Refresh textual sensor values only periodically to prevent them from being totally unreadable from being changed too fast.

set_units(units)

Set pressure units to display as cmH2O or hPa.

set_locked(locked)

Set locked status of control

value_changed(*args, **kwargs) = <PySide2.QtCore.Signal object>

Signal emitted when controlled value of display object has changed.

Contains new value (float)

init_ui()[source]

UI is initialized in several stages

init_ui_labels()[source]
init_ui_toggle_button()[source]
init_ui_limits()[source]

Create widgets to display sensed value alongside set value

init_ui_slider()[source]
init_ui_record()[source]
init_ui_layout()[source]

Basically two methods… lay objects out depending on whether we’re oriented with our button to the left or right

init_ui_signals()[source]
toggle_control(state)[source]

Toggle the appearance of the slider, if a slider

Parameters

state (bool) – Whether to show or hide the slider

toggle_record(state)[source]

Toggle the recording state, if a recording control

Parameters

state (bool) – Whether recording should be started or stopped. when started, start storing new sensor values in a list. when stopped, average thgem and emit new value.

_value_changed(new_value: float)[source]

“outward-directed” method to emit new changed control value when changed by this widget

Pop a confirmation dialog if values are set outside the safe range.

Parameters
  • new_value (float) – new value!

  • emit (bool) – whether to emit the value_changed signal (default True) – in the case that our value is being changed by someone other than us

update_set_value(new_value: float)[source]

Update to reflect new control value set from elsewhere (inwardly directed setter)

Parameters

new_value (float) – new value to set!

update_sensor_value(new_value: float)[source]

Receive new sensor value and update display widgets

Parameters

new_value (float) – new sensor value!

update_limits(control: pvp.common.message.ControlSetting)[source]

Update the alarm range and the GUI elements corresponding to it

Parameters

control (ControlSetting) – control setting with min_value or max_value

redraw()[source]

Redraw all graphical elements to ensure internal model matches view

Typically used when changing units

timed_update()[source]

Refresh textual sensor values only periodically to prevent them from being totally unreadable from being changed too fast.

set_units(units: str)[source]

Set pressure units to display as cmH2O or hPa.

Uses functions from pvp.common.unit_conversion such that

  • self._convert_in converts internal, canonical units to displayed units (eg. cmH2O is used by all other modules, so we convert it to hPa

  • self._convert_out converts displayed units to send to other parts of the system

Note

currently unit conversion is only supported for Pressure.

Parameters

units ('cmH2O', 'hPa') – new units to display

set_locked(locked: bool)[source]

Set locked status of control

Parameters

locked (bool) – If True, disable all controlling widgets, if False, re-enable.

property is_set

Check if value has been set for this control.

Used to check if all settings have been set preflight by PVP_Gui

Returns

whether we have an Display.set_value

Return type

bool

property alarm_state: pvp.alarm.AlarmSeverity

Current visual display of alarm severity

Change sensor value color to reflect the alarm state of that set parameter –

eg. if we have a HAPA alarm, set the PIP control to display as red.

Returns

AlarmSeverity

staticMetaObject = <PySide2.QtCore.QMetaObject object>
class pvp.gui.widgets.display.Limits_Plot(style: str = 'light', *args, **kwargs)[source]

Widget to display current value in a bar graph along with alarm limits

Parameters

style ('light', 'dark') – Whether we are being displayed in a light or dark styled Display widget

set_value

Set value of control, displayed as horizontal black line always set at center of bar

Type

float

sensor_value

Sensor value to compare against control, displayed as bar

Type

float

When initializing PlotWidget, parent and background are passed to GraphicsWidget.__init__() and all others are passed to PlotItem.__init__().

Attributes:

staticMetaObject

Methods:

init_ui()

Create bar chart and horizontal lines to reflect

update_value([min, max, sensor_value, set_value])

Move the lines! Pass any of the represented values.

update_yrange()

Set yrange to ensure that the set value is always in the center of the plot and that all the values are in range.

staticMetaObject = <PySide2.QtCore.QMetaObject object>
init_ui()[source]

Create bar chart and horizontal lines to reflect

  • Sensor Value

  • Set Value

  • High alarm limit

  • Low alarm limit

update_value(min: Optional[float] = None, max: Optional[float] = None, sensor_value: Optional[float] = None, set_value: Optional[float] = None)[source]

Move the lines! Pass any of the represented values.

Also updates yrange to ensure that the control value is always centered in the plot

Parameters
  • min (float) – new alarm minimum

  • max (float) – new alarm _maximum

  • sensor_value (float) – new value for the sensor bar plot

  • set_value (float) – new value for the set value line

update_yrange()[source]

Set yrange to ensure that the set value is always in the center of the plot and that all the values are in range.