Alarm Bar¶
The Alarm_Bar
displays Alarm
status with Alarm_Card
widgets
and plays alarm sounds with the Alarm_Sound_Player
Classes:
Holds and manages a collection of |
|
|
Representation of an alarm raised by |
|
Plays alarm sounds to reflect current alarm severity and active duration with |
- class pvp.gui.widgets.alarm_bar.Alarm_Bar[source]¶
Holds and manages a collection of
Alarm_Card
s and communicates requests for dismissal to theAlarm_Manager
The alarm bar also manages the
Alarm_Sound_Player
- alarm_cards¶
A list of active alarm cards
- Type
- sound_player¶
Class that plays alarm sounds!
- Type
Methods:
Create pixmaps from standard icons to display for different alarm types
init_ui
()Initialize the UI
add_alarm
(alarm)Add an alarm created by the
Alarm_Manager
to the bar.clear_alarm
([alarm, alarm_type])Remove an alarm card, update appearance and sound player to reflect current max severity
Call
set_icon()
with highest severity inAlarm_Bar.alarms
set_icon
([state])Change the icon and bar appearance to reflect the alarm severity
Attributes:
Current maximum
AlarmSeverity
- make_icons()[source]¶
Create pixmaps from standard icons to display for different alarm types
Store in
Alarm_Bar.icons
- add_alarm(alarm: pvp.alarm.alarm.Alarm)[source]¶
Add an alarm created by the
Alarm_Manager
to the bar.If an alarm alreaady exists with that same
AlarmType
,Alarm_Bar.clear_alarm()
Insert new alarm in order the prioritizes alarm severity with highest severity on right
Set alarm sound and begin playing if not already.
- Parameters
alarm (
Alarm
) – Alarm to be added
- clear_alarm(alarm: Optional[pvp.alarm.alarm.Alarm] = None, alarm_type: Optional[pvp.alarm.AlarmType] = None)[source]¶
Remove an alarm card, update appearance and sound player to reflect current max severity
Must pass one of either
alarm
oralarm_type
- update_icon()[source]¶
Call
set_icon()
with highest severity inAlarm_Bar.alarms
- set_icon(state: Optional[pvp.alarm.AlarmSeverity] = None)[source]¶
Change the icon and bar appearance to reflect the alarm severity
- Parameters
state (
AlarmSeverity
) – Alarm Severity to display, if None change to default display
- property alarm_level¶
Current maximum
AlarmSeverity
- Returns
- staticMetaObject = <PySide2.QtCore.QMetaObject object>¶
- class pvp.gui.widgets.alarm_bar.Alarm_Card(alarm: pvp.alarm.alarm.Alarm)[source]¶
Representation of an alarm raised by
Alarm_Manager
in GUI.If allowed by alarm (by
latch
setting) , allows user to dismiss/silence alarm.Otherwise request to dismiss is logged by
Alarm_Manager
and the card is dismissed when the conditions that generated the alarm are no longer met.- Parameters
alarm (
Alarm
) – Alarm to represent
- severity¶
The severity of the represented alarm
- Type
- close_button¶
Button that requests an alarm be dismissed
- Type
PySide2.QtWidgets.QPushButton
Methods:
init_ui
()Initialize graphical elements
_dismiss
()Gets the
Alarm_Manager
instance and callsAlarm_Manager.dismiss_alarm()
Attributes:
- init_ui()[source]¶
Initialize graphical elements
Create labels
Set stylesheets
Create and connect dismiss button
Returns:
- _dismiss()[source]¶
Gets the
Alarm_Manager
instance and callsAlarm_Manager.dismiss_alarm()
Also change appearance of close button to reflect requested dismissal
- staticMetaObject = <PySide2.QtCore.QMetaObject object>¶
- class pvp.gui.widgets.alarm_bar.Alarm_Sound_Player(increment_delay: int = 10000, *args, **kwargs)[source]¶
Plays alarm sounds to reflect current alarm severity and active duration with
PySide2.QtMultimedia.QSoundEffect
objectsAlarm sounds indicate severity with the number and pitch of tones in a repeating tone cluster (eg. low severity sounds have a single repeating tone, but high-severity alarms have three repeating tones)
They indicate active duration by incrementally removing a low-pass filter and making tones have a sharper attack and decay.
When an alarm of any severity is started the
<severity_0.wav
file begins playing, and a timer is started to callAlarm_Sound_Player.increment_level()
- Parameters
increment_delay (int) – Delay between calling
Alarm_Sound_Player.increment_level()
**kwargs (*args,) –
passed to
PySide2.QtWidgets.QWidget
- idx¶
Dictionary of dictionaries allowing sounds to be accessed like
self.idx[AlarmSeverity][level]
- Type
- _increment_timer¶
Timer that increments alarm sound level
- Type
PySide2.QtCore.QTimer
- _changing_track¶
used to ensure single sound changing call happens at a time.
- Type
Attributes:
mapping between string representations of severities used by filenames and
AlarmSeverity
Methods:
Load audio files in
pvp/external/audio
and add toAlarm_Sound_Player.idx
play
()Start sound playback
stop
()Stop sound playback
set_sound
([severity, level])Set sound to be played
If current level is below the maximum level, increment with
Alarm_Sound_Player.set_sound()
Returns:set_mute
(mute)Set mute state
- severity_map = {'high': AlarmSeverity.HIGH, 'low': AlarmSeverity.LOW, 'medium': AlarmSeverity.MEDIUM}¶
mapping between string representations of severities used by filenames and
AlarmSeverity
- init_audio()[source]¶
Load audio files in
pvp/external/audio
and add toAlarm_Sound_Player.idx
- play()[source]¶
Start sound playback
Play sound listed as
Alarm_Sound_Player._current_sound
Note
Alarm_Sound_Player.set_sound()
must be called first.
- set_sound(severity: Optional[pvp.alarm.AlarmSeverity] = None, level: Optional[int] = None)[source]¶
Set sound to be played
At least an
AlarmSeverity
must be provided.- Parameters
severity (
AlarmSeverity
) – Severity of alarm sound to playlevel (int) – level (corresponding to active duration) of sound to play
- increment_level()[source]¶
If current level is below the maximum level, increment with
Alarm_Sound_Player.set_sound()
Returns:
- staticMetaObject = <PySide2.QtCore.QMetaObject object>¶