Alarm Bar¶
The Alarm_Bar
displays Alarm
status with Alarm_Card
widgets
and plays alarm sounds with the Alarm_Sound_Player
Classes:
|
Representation of alarm status and parameters |
|
An enumeration. |
|
An enumeration. |
Holds and manages a collection of |
|
|
Representation of an alarm raised by |
|
The Alarm Manager |
|
Plays alarm sounds to reflect current alarm severity and active duration with |
Functions:
|
Initialize a logger for logging events. |
|
module function to return a |
-
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
-
alarms
¶ A list of active alarms
- Type
-
alarm_cards
¶ A list of active alarm cards
- Type
-
sound_player
¶ Class that plays alarm sounds!
- Type
Methods:
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
init_ui
()Initialize the UI
Create pixmaps from standard icons to display for different alarm types
set_icon
([state])Change the icon and bar appearance to reflect the alarm severity
Call
set_icon()
with highest severity inAlarm_Bar.alarms
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: pvp.alarm.alarm.Alarm = None, alarm_type: 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: 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
Button that requests an alarm be dismissed
- Type
PySide2.QtWidgets.QPushButton
Methods:
_dismiss
()Gets the
Alarm_Manager
instance and callsAlarm_Manager.dismiss_alarm()
init_ui
()Initialize graphical elements
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
Methods:
If current level is below the maximum level, increment with
Alarm_Sound_Player.set_sound()
Returns:Load audio files in
pvp/external/audio
and add toAlarm_Sound_Player.idx
play
()Start sound playback
set_mute
(mute)Set mute state
set_sound
([severity, level])Set sound to be played
stop
()Stop sound playback
Attributes:
mapping between string representations of severities used by filenames and
AlarmSeverity
-
severity_map
= {'high': <AlarmSeverity.HIGH: 3>, 'low': <AlarmSeverity.LOW: 1>, 'medium': <AlarmSeverity.MEDIUM: 2>}¶ 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: pvp.alarm.AlarmSeverity = None, level: 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>¶