vent.gui package¶
Subpackages¶
Submodules¶
vent.gui.alarm_manager module¶
Classes
Functions
-
class
vent.gui.alarm_manager.
AlarmManager
[source]¶ Bases:
PySide2.QtCore.QObject
Methods
monitor_alarm
(alarm)Parse a tentative alarm from a monitor – we should have already gotten an alarm from the controller, so this largely serves as a double check.
parse_message
(alarm)If an alarm doesn’t have a
message
attr, make one for it.update_alarms
(alarms)-
new_alarm
(*args, **kwargs) = <PySide2.QtCore.Signal object>¶
-
monitor_alarm
(alarm)[source]¶ Parse a tentative alarm from a monitor – we should have already gotten an alarm from the controller, so this largely serves as a double check.
Doesn’t use the
Alarm
class because creating a new alarm increments the counter.- Parameters
alarm (tuple) – (monitor_name, monitor_value, timestamp)
-
staticMetaObject
= <PySide2.QtCore.QMetaObject object>¶
-
vent.gui.main module¶
Classes
|
The Main GUI window. |
Functions
|
-
class
vent.gui.main.
Vent_Gui
(coordinator, update_period=0.1)[source]¶ Bases:
PySide2.QtWidgets.QMainWindow
The Main GUI window.
Only one instance can be created at a time. Uses
set_gui_instance()
to store a reference to itself. after initialization, use get_gui_instance to retrieve a reference.Attributes
see
gui.defaults.CONTROL
see
gui.defaults.SENSOR
see
gui.defaults.PLOTS
alarms_updated
(*args, **kwargs)PySide2.QtCore.Signal
emitted whenever alarms are updated.int([x]) -> integer
gui_closing
(*args, **kwargs)PySide2.QtCore.Signal
emitted when the GUI is closing.int([x]) -> integer
int([x]) -> integer
int([x]) -> integer
int([x]) -> integer
computed from
status_height+main_height
computed from
monitor_width+plot_width+control_width
Methods
__init__
(coordinator[, update_period])The Main GUI window.
alarm_state_changed
(state)closeEvent
(event)Emit
gui_closing
and close!handle_alarm
(alarm)handle_cleared_alarm
(alarm)on startup, set controls in coordinator to ensure init state is synchronized
init_ui
()Create the UI components for the ventilator screen
Connect Qt signals and slots
set_plot_duration
(dur)set_value
(new_value[, value_name])Set a control value with the
coordinator
start
()Click the
start()
buttonupdate_value
(value_name, new_value)- param value_name
Name of key in
Vent_Gui.monitor
andVent_Gui.plots
to update
-
monitor
¶ Dictionary mapping
values.SENSOR
keys towidgets.Monitor_Value
objects- Type
-
controls
¶ Dictionary mapping
values.CONTROL
keys towidgets.Control
objects- Type
-
coordinator
¶ Some coordinator object that we use to communicate with the controller
-
control_module
¶ Reference to the control module, retrieved from coordinator
-
start_time
¶ Start time as returned by
time.time()
- Type
-
alarm_manager
¶ - Type
- Parameters
-
gui_closing
(*args, **kwargs) = <PySide2.QtCore.Signal object>¶ PySide2.QtCore.Signal
emitted when the GUI is closing.
-
alarms_updated
(*args, **kwargs) = <PySide2.QtCore.Signal object>¶ PySide2.QtCore.Signal
emitted whenever alarms are updated.Returns the result of
self.coordinator.get_active_alarms
, so will emit an empty dict if there are no active alarms.
-
MONITOR
= OrderedDict([(<ValueName.FIO2: 8>, <vent.common.values.Value object>), (<ValueName.TEMP: 9>, <vent.common.values.Value object>), (<ValueName.HUMIDITY: 10>, <vent.common.values.Value object>), (<ValueName.VTE: 11>, <vent.common.values.Value object>), (<ValueName.PRESSURE: 12>, <vent.common.values.Value object>), (<ValueName.PIP: 1>, <vent.common.values.Value object>), (<ValueName.INSPIRATION_TIME_SEC: 6>, <vent.common.values.Value object>), (<ValueName.PEEP: 3>, <vent.common.values.Value object>), (<ValueName.BREATHS_PER_MINUTE: 5>, <vent.common.values.Value object>)])¶ see
gui.defaults.SENSOR
-
CONTROL
= OrderedDict([(<ValueName.PIP: 1>, <vent.common.values.Value object>), (<ValueName.PIP_TIME: 2>, <vent.common.values.Value object>), (<ValueName.INSPIRATION_TIME_SEC: 6>, <vent.common.values.Value object>), (<ValueName.PEEP: 3>, <vent.common.values.Value object>), (<ValueName.PEEP_TIME: 4>, <vent.common.values.Value object>), (<ValueName.BREATHS_PER_MINUTE: 5>, <vent.common.values.Value object>)])¶ see
gui.defaults.CONTROL
-
PLOTS
= OrderedDict([(<ValueName.PRESSURE: 12>, {'name': 'Pressure', 'units': 'mmH2O', 'abs_range': (0, 70), 'safe_range': (0, 60), 'decimals': 1, 'default': None, 'control': False, 'sensor': True, 'color': '#FF6319'}), (<ValueName.TEMP: 9>, {'name': 'Temp', 'units': '°C', 'abs_range': (35, 40), 'safe_range': (36, 39), 'decimals': 1, 'default': None, 'control': False, 'sensor': True, 'color': '#EE352E'}), (<ValueName.HUMIDITY: 10>, {'name': 'Humidity', 'units': '%', 'abs_range': (0, 100), 'safe_range': (70, 100), 'decimals': 1, 'default': None, 'control': False, 'sensor': True, 'color': '#0039A6'})])¶ see
gui.defaults.PLOTS
-
monitor_width
= 2¶
-
plot_width
= 4¶
-
control_width
= 2¶
-
total_width
= 8¶ computed from
monitor_width+plot_width+control_width
-
status_height
= 1¶
-
main_height
= 5¶
-
total_height
= 6¶ computed from
status_height+main_height
-
__init__
(coordinator, update_period=0.1)[source]¶ The Main GUI window.
Only one instance can be created at a time. Uses
set_gui_instance()
to store a reference to itself. after initialization, use get_gui_instance to retrieve a reference.-
monitor
¶ Dictionary mapping
values.SENSOR
keys towidgets.Monitor_Value
objects- Type
-
controls
¶ Dictionary mapping
values.CONTROL
keys towidgets.Control
objects- Type
-
coordinator
¶ Some coordinator object that we use to communicate with the controller
-
control_module
¶ Reference to the control module, retrieved from coordinator
-
start_time
¶ Start time as returned by
time.time()
- Type
-
alarm_manager
¶ - Type
-
-
property
update_period
¶
-
init_controls
()[source]¶ on startup, set controls in coordinator to ensure init state is synchronized
-
set_value
(new_value, value_name=None)[source]¶ Set a control value with the
coordinator
- Parameters
new_value (float) – Som
-
update_value
(value_name, new_value)[source]¶ - Parameters
value_name (str) – Name of key in
Vent_Gui.monitor
andVent_Gui.plots
to update
-
staticMetaObject
= <PySide2.QtCore.QMetaObject object>¶
-
property
alarm_state
¶
-
closeEvent
(event)[source]¶ Emit
gui_closing
and close!
vent.gui.styles module¶
Data
inter-update interval (seconds) for |
Functions
|
Apply Dark Theme to the Qt application instance. |
-
vent.gui.styles.
MONITOR_UPDATE_INTERVAL
= 0.5¶ inter-update interval (seconds) for
Monitor
- Type
(float)
-
vent.gui.styles.
set_dark_palette
(app)[source]¶ Apply Dark Theme to the Qt application instance.
- borrowed from https://github.com/gmarull/qtmodern/blob/master/qtmodern/styles.py
- Args:
app (QApplication): QApplication instance.
Module contents¶
Data
whether there hsould only be one GUI instance at a time. disabled during testing. |
|
Values to plot. |
Functions
Retreive the currently running instance of the GUI |
|
|
|
Load the monospaced font and set the module-global |
|
module function to return a |
|
|
Store the current instance of the GUI |
-
vent.gui.
LIMIT_GUI_INSTANCE
= False¶ whether there hsould only be one GUI instance at a time. disabled during testing.
- Type
(bool)
-
vent.gui.
PLOTS
= OrderedDict([(<ValueName.PRESSURE: 12>, {'name': 'Pressure', 'units': 'mmH2O', 'abs_range': (0, 70), 'safe_range': (0, 60), 'decimals': 1, 'default': None, 'control': False, 'sensor': True, 'color': '#FF6319'}), (<ValueName.TEMP: 9>, {'name': 'Temp', 'units': '°C', 'abs_range': (35, 40), 'safe_range': (36, 39), 'decimals': 1, 'default': None, 'control': False, 'sensor': True, 'color': '#EE352E'}), (<ValueName.HUMIDITY: 10>, {'name': 'Humidity', 'units': '%', 'abs_range': (0, 100), 'safe_range': (70, 100), 'decimals': 1, 'default': None, 'control': False, 'sensor': True, 'color': '#0039A6'})])¶ Values to plot.
Should have the same key as some key in
SENSOR
. If it does, it will be mutually connected to the resultinggui.widgets.Monitor_Value
such that the set limit range is updated when the horizontal bars on the plot are updated.:{ 'name' (str): title of plot, 'abs_range' (tuple): absolute limit of plot range, 'safe_range' (tuple): safe range, will be discolored outside of this range, 'color' (str): hex color of line (like "#FF0000") }
-
vent.gui.
set_gui_instance
(instance)[source]¶ Store the current instance of the GUI
- Parameters
instance (
Vent_Gui
) –
-
vent.gui.
mono_font
()[source]¶ module function to return a
PySide2.QtGui.QFont
to use as the mono font.use this instead of just making because
PySide2.QtGui.QFontDatabase
can’t be instantiated before thePySide2.QtWidgets.QApplication
is instantiated, so we load the font after the app