Control Panel

The Control Panel starts and stops ventilation and controls runtime options

Classes:

Control_Panel()

The control panel starts and stops ventilation and controls runtime settings

Start_Button(*args, **kwargs)

Button to start and stop Ventilation, created by Control_Panel

Lock_Button(*args, **kwargs)

Button to lock and unlock controls

HeartBeat([update_interval, timeout_dur])

Track state of connection with Controller

StopWatch([update_interval])

Simple widget to display ventilation time!

class pvp.gui.widgets.control_panel.Control_Panel[source]

The control panel starts and stops ventilation and controls runtime settings

It creates:

  • Start/stop button

  • Status indicator - a clock that increments with heartbeats,

    or some other visual indicator that things are alright

  • Version indicator

  • Buttons to select options like cycle autoset and automatic breath detection

Args:

start_button

Button to start and stop ventilation

Type

Start_Button

lock_button

Button used to lock controls

Type

Lock_Button

heartbeat

Widget to keep track of communication with controller

Type

HeartBeat

runtime

Widget used to display time since start of ventilation

Type

StopWatch

Attributes:

pressure_units_changed(*args, **kwargs)

Signal emitted when pressure units have been changed.

cycle_autoset_changed(*args, **kwargs)

Signal emitted when a different breath cycle control value is set to be autocalculated

staticMetaObject

Methods:

init_ui()

Initialize all graphical elements and buttons!

_pressure_units_changed(button)

Emit the str of the current pressure units

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

Signal emitted when pressure units have been changed.

Contains str of current pressure units

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

Signal emitted when a different breath cycle control value is set to be autocalculated

init_ui()[source]

Initialize all graphical elements and buttons!

_pressure_units_changed(button)[source]

Emit the str of the current pressure units

Parameters

button (PySide2.QtWidgets.QPushButton) – Button that was clicked

staticMetaObject = <PySide2.QtCore.QMetaObject object>
class pvp.gui.widgets.control_panel.Start_Button(*args, **kwargs)[source]

Button to start and stop Ventilation, created by Control_Panel

pixmaps

Dictionary containing pixmaps used to draw start/stop state

Type

dict

Attributes:

states

Possible states of Start_Button

staticMetaObject

Methods:

load_pixmaps()

Load pixmaps to Start_Button.pixmaps

set_state(state)

Set state of button

states = ['OFF', 'ON', 'ALARM']

Possible states of Start_Button

load_pixmaps()[source]

Load pixmaps to Start_Button.pixmaps

set_state(state)[source]

Set state of button

Should only be called by other objects (as there are checks to whether it’s ok to start/stop that we shouldn’t be aware of)

Parameters

state (str) – one of ('OFF', 'ON', 'ALARM')

staticMetaObject = <PySide2.QtCore.QMetaObject object>
class pvp.gui.widgets.control_panel.Lock_Button(*args, **kwargs)[source]

Button to lock and unlock controls

Created by Control_Panel

pixmaps

Dictionary containing pixmaps used to draw locked/unlocked state

Type

dict

Attributes:

states

Possible states of Lock Button

staticMetaObject

Methods:

load_pixmaps()

Load pixmaps used to display lock state to Lock_Button.pixmaps

set_state(state)

Set lock state of button

states = ['DISABLED', 'UNLOCKED', 'LOCKED']

Possible states of Lock Button

load_pixmaps()[source]

Load pixmaps used to display lock state to Lock_Button.pixmaps

set_state(state)[source]

Set lock state of button

Should only be called by other objects (as there are checks to whether it’s ok to start/stop that we shouldn’t be aware of)

Parameters

state (str) – ('OFF', 'ON', 'ALARM')

staticMetaObject = <PySide2.QtCore.QMetaObject object>
class pvp.gui.widgets.control_panel.HeartBeat(update_interval: int = 100, timeout_dur: int = 5000)[source]

Track state of connection with Controller

Check when we last had contact with controller every HeartBeat.update_interval ms, if longer than HeartBeat.timeout_dur then emit a timeout signal

Parameters
  • update_interval (int) – How often to do the heartbeat, in ms

  • timeout (int) – how long to wait before hearing from control process, in ms

_state

whether the system is running or not

Type

bool

_last_heartbeat

Timestamp of last contact with controller

Type

float

start_time

Time that ventilation was started

Type

float

timer

Timer that checks for last contact

Type

PySide2.QtCore.QTimer

update_interval

How often to do the heartbeat, in ms

Type

int

timeout

how long to wait before hearing from control process, in ms

Type

int

Attributes:

timeout(*args, **kwargs)

Signal that a timeout has occurred -- too long between contact with controller.

heartbeat(*args, **kwargs)

Signal that requests to affirm contact with controller if no message has been received in timeout duration

staticMetaObject

Methods:

init_ui()

Initialize labels and status indicator

set_state(state)

Set running state

set_indicator([state])

Set visual indicator

start_timer([update_interval])

Start HeartBeat.timer to check for contact with controller

stop_timer()

Stop timer and clear text

beatheart(heartbeat_time)

Slot that receives timestamps of last contact with controller

_heartbeat()

Called every (update_interval) milliseconds to set the check the status of the heartbeat.

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

Signal that a timeout has occurred – too long between contact with controller.

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

Signal that requests to affirm contact with controller if no message has been received in timeout duration

init_ui()[source]

Initialize labels and status indicator

set_state(state)[source]

Set running state

if just starting reset HeartBeat._last_heartbeat

Parameters

state (bool) – Whether we are starting (True) or stopping (False)

set_indicator(state=None)[source]

Set visual indicator

Parameters

state ('ALARM', 'OFF', 'NORMAL') – Current state of connection with controller

start_timer(update_interval=None)[source]

Start HeartBeat.timer to check for contact with controller

Parameters

update_interval (int) – How often (in ms) the timer should be updated. if None, use self.update_interval

stop_timer()[source]

Stop timer and clear text

beatheart(heartbeat_time)[source]

Slot that receives timestamps of last contact with controller

Parameters

heartbeat_time (float) – timestamp of last contact with controller

_heartbeat()[source]

Called every (update_interval) milliseconds to set the check the status of the heartbeat.

staticMetaObject = <PySide2.QtCore.QMetaObject object>
class pvp.gui.widgets.control_panel.StopWatch(update_interval: float = 100, *args, **kwargs)[source]

Simple widget to display ventilation time!

Parameters
  • update_interval (float) – update clock every n seconds

  • *args – passed to PySide2.QtWidgets.QLabel

  • **kwargs – passed to PySide2.QtWidgets.QLabel

Methods:

__init__([update_interval])

Simple widget to display ventilation time!

init_ui()

start_timer([update_interval])

param update_interval

How often (in ms) the timer should be updated.

stop_timer()

Stop timer and reset label

_update_time()

Attributes:

staticMetaObject

__init__(update_interval: float = 100, *args, **kwargs)[source]

Simple widget to display ventilation time!

Parameters
  • update_interval (float) – update clock every n seconds

  • *args – passed to PySide2.QtWidgets.QLabel

  • **kwargs – passed to PySide2.QtWidgets.QLabel

staticMetaObject = <PySide2.QtCore.QMetaObject object>
init_ui()[source]
start_timer(update_interval=None)[source]
Parameters

update_interval (float) – How often (in ms) the timer should be updated.

stop_timer()[source]

Stop timer and reset label

_update_time()[source]