gui

Program Diagram

images/gui_diagram.png

Schematic diagram of major UI components and signals

Design Requirements

  • Display Values

    • Value name, units, absolute range, recommended range, default range

    • VTE

    • FiO2

    • Humidity

    • Temperature

  • Plots

  • Controlled Values

    • PIP

    • PEEP

    • Inspiratory Time

  • Value Dependencies

UI Notes & Todo

  • Jonny add notes from helpful RT in discord!!!

  • Top status Bar

    • Start/stop button

    • Status indicator - a clock that increments with heartbeats, or some other visual indicator that things are alright

    • Status bar - most recent alarm or notification w/ means of clearing

    • Override to give 100% oxygen and silence all alarms

  • API

    • Two queues, input and output. Read from socket and put directly into queue.

    • Input, receive (timestamp, key, value) messages where key and value are names of variables and their values

    • Output, send same format

  • Menus

    • Trigger some testing/calibration routine

    • Log/alarm viewer

    • Wizard to set values?

    • save/load values

  • Alarms

    • Multiple levels

    • Silenced/reset

    • Logging

    • Sounds?

  • General

    • Reduce space given to waveforms

    • Clearer grouping & titling for display values & controls

    • Collapsible range setting

    • Ability to declare dependencies between values

      • Limits - one value’s range logically depends on another

      • Derived - one value is computed from another/others

    • Monitored values should have defaults, warning range, and absolute range

    • Two classes of monitored values – ones with limits and ones without. There seem to be lots and lots of observed values, but only some need limits. might want to make larger drawer of smaller displayed values that don’t need controls

    • Save/load parameters. Autosave, and autorestore if saved <5m ago, otherwise init from defaults.

    • Implement timed updates to plots to limit resource usage

    • Make class for setting values

    • Possible plots

      • Pressure vs. flow

      • flow vs volume

      • volume vs time

  • Performance

    • Cache drawText() calls in range selector by drawing to pixmap

Jonny Questions

  • Which alarm sounds to use?

  • Final final final breakdown on values and ranges plzzz

jonny todo

  • use loop_counter to check on controller advancement

  • implement single values list with properties ‘controllable’ vs not.

GUI Object Documentation

Control

Monitor

Classes

Monitor(value[, update_period, enum_name])

param value

class vent.gui.widgets.monitor.Monitor(value, update_period=0.5, enum_name=None)[source]
Parameters
  • value (Value) –

  • update_period (float) – update period of monitor in s

Methods

__init__(value[, update_period, enum_name])

param value

_limits_changed(val)

check_alarm([value])

init_ui()

set_alarm(alarm)

Simple wrapper to set alarm state from a qt signal

timed_update()

toggle_alarm()

toggle_control(state)

update_boxes(new_values)

update_limits(new_limits)

update_value(new_value)

Attributes

alarm_state

alarm(*args, **kwargs) = <PySide2.QtCore.Signal object>
limits_changed(*args, **kwargs) = <PySide2.QtCore.Signal object>
__init__(value, update_period=0.5, enum_name=None)[source]
Parameters
  • value (Value) –

  • update_period (float) – update period of monitor in s

init_ui()[source]
toggle_control(state)[source]
update_boxes(new_values)[source]
update_value(new_value)[source]
update_limits(new_limits)[source]
timed_update()[source]
_limits_changed(val)[source]
property alarm_state
set_alarm(alarm)[source]

Simple wrapper to set alarm state from a qt signal

Parameters

alarm (bool) – Whether to set as alarm state or not

toggle_alarm()[source]
check_alarm(value=None)[source]
staticMetaObject = <PySide2.QtCore.QMetaObject object>

Plot

Data

PLOT_FREQ

Update frequency of Plot s in Hz

PLOT_TIMER

A QTimer that updates :class:`.TimedPlotCurveItem`s

Classes

Plot(name[, buffer_size, plot_duration, …])

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

vent.gui.widgets.plot.PLOT_TIMER = None

A QTimer that updates :class:`.TimedPlotCurveItem`s

vent.gui.widgets.plot.PLOT_FREQ = 5

Update frequency of Plot s in Hz

class vent.gui.widgets.plot.Plot(name, buffer_size=4092, plot_duration=5, abs_range=None, safe_range=None, color=None, units='', **kwargs)[source]

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

Methods

_safe_limits_changed(val)

set_duration(dur)

set_safe_limits(limits)

update_value(new_value)

new_value: (timestamp from time.time(), value)

limits_changed(*args, **kwargs) = <PySide2.QtCore.Signal object>
set_duration(dur)[source]
staticMetaObject = <PySide2.QtCore.QMetaObject object>
update_value(new_value)[source]

new_value: (timestamp from time.time(), value)

_safe_limits_changed(val)[source]
set_safe_limits(limits)[source]

Status Bar

Classes

HeartBeat([update_interval, timeout_dur])

param update_interval

How often to do the heartbeat, in ms

Message_Display()

Power_Button()

Status_Bar()

  • Start/stop button

class vent.gui.widgets.status_bar.Status_Bar[source]
  • Start/stop button

  • Status indicator - a clock that increments with heartbeats,

    or some other visual indicator that things are alright

  • Status bar - most recent alarm or notification w/ means of clearing

  • Override to give 100% oxygen and silence all alarms

Methods

init_ui()

init_ui()[source]
staticMetaObject = <PySide2.QtCore.QMetaObject object>
class vent.gui.widgets.status_bar.Message_Display[source]

Attributes

alarm_level

Methods

clear_message()

draw_state([state])

init_ui()

make_icons()

update_message(alarm)

param alarm

message_cleared(*args, **kwargs) = <PySide2.QtCore.Signal object>
level_changed(*args, **kwargs) = <PySide2.QtCore.Signal object>
make_icons()[source]
init_ui()[source]
draw_state(state=None)[source]
update_message(alarm)[source]
Parameters

alarm (Alarm) –

clear_message()[source]
property alarm_level
staticMetaObject = <PySide2.QtCore.QMetaObject object>
class vent.gui.widgets.status_bar.HeartBeat(update_interval=100, timeout_dur=5000)[source]
Parameters
  • update_interval (int) – How often to do the heartbeat, in ms

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

Methods

__init__([update_interval, timeout_dur])

param update_interval

How often to do the heartbeat, in ms

_heartbeat()

Called every (update_interval) milliseconds to set the text of the timer.

beatheart(heartbeat_time)

check_timeout()

init_ui()

set_indicator([state])

start_timer([update_interval])

param update_interval

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

stop_timer()

you can read the sign ya punk

timeout(*args, **kwargs) = <PySide2.QtCore.Signal object>
heartbeat(*args, **kwargs) = <PySide2.QtCore.Signal object>
__init__(update_interval=100, timeout_dur=5000)[source]
Parameters
  • update_interval (int) – How often to do the heartbeat, in ms

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

init_ui()[source]
check_timeout()[source]
set_indicator(state=None)[source]
start_timer(update_interval=None)[source]
Parameters

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

stop_timer()[source]

you can read the sign ya punk

beatheart(heartbeat_time)[source]
_heartbeat()[source]

Called every (update_interval) milliseconds to set the text of the timer.

staticMetaObject = <PySide2.QtCore.QMetaObject object>
class vent.gui.widgets.status_bar.Power_Button[source]

Methods

init_ui()

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

Components

GUI Stylesheets

Data

MONITOR_UPDATE_INTERVAL

inter-update interval (seconds) for Monitor

Functions

set_dark_palette(app)

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.

GUI Alarm Manager

Classes

AlarmManager()

Functions

get_alarm_manager()

vent.gui.alarm_manager.get_alarm_manager()[source]
class vent.gui.alarm_manager.AlarmManager[source]

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>
update_alarms(alarms)[source]
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)

parse_message(alarm)[source]

If an alarm doesn’t have a message attr, make one for it.

staticMetaObject = <PySide2.QtCore.QMetaObject object>