Alarm Bar

The Alarm_Bar displays Alarm status with Alarm_Card widgets and plays alarm sounds with the Alarm_Sound_Player

Classes:

Alarm_Bar()

Holds and manages a collection of Alarm_Card s and communicates requests for dismissal to the Alarm_Manager

Alarm_Card(alarm)

Representation of an alarm raised by Alarm_Manager in GUI.

Alarm_Sound_Player([increment_delay])

Plays alarm sounds to reflect current alarm severity and active duration with PySide2.QtMultimedia.QSoundEffect objects

class pvp.gui.widgets.alarm_bar.Alarm_Bar[source]

Holds and manages a collection of Alarm_Card s and communicates requests for dismissal to the Alarm_Manager

The alarm bar also manages the Alarm_Sound_Player

alarms

A list of active alarms

Type

List[Alarm]

alarm_cards

A list of active alarm cards

Type

List[Alarm_Card]

sound_player

Class that plays alarm sounds!

Type

Alarm_Sound_Player

icons

Dictionary of pixmaps with icons for different alarm levels

Type

dict

Methods:

make_icons()

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

update_icon()

Call set_icon() with highest severity in Alarm_Bar.alarms

set_icon([state])

Change the icon and bar appearance to reflect the alarm severity

Attributes:

alarm_level

Current maximum AlarmSeverity

staticMetaObject

make_icons()[source]

Create pixmaps from standard icons to display for different alarm types

Store in Alarm_Bar.icons

init_ui()[source]

Initialize the UI

  • Create layout

  • Set icon

  • Create mute button

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 or alarm_type

Parameters
  • alarm (Alarm) – Alarm to be cleared

  • alarm_type (AlarmType) – Alarm type to be cleared

update_icon()[source]

Call set_icon() with highest severity in Alarm_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

AlarmSeverity

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

alarm

The represented alarm

Type

Alarm

severity

The severity of the represented alarm

Type

AlarmSeverity

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 calls Alarm_Manager.dismiss_alarm()

Attributes:

staticMetaObject

init_ui()[source]

Initialize graphical elements

  • Create labels

  • Set stylesheets

  • Create and connect dismiss button

Returns:

_dismiss()[source]

Gets the Alarm_Manager instance and calls Alarm_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 objects

Alarm 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 call Alarm_Sound_Player.increment_level()

Parameters
idx

Dictionary of dictionaries allowing sounds to be accessed like self.idx[AlarmSeverity][level]

Type

dict

files

list of sound file paths

Type

list

increment_delay

Time between calling Alarm_Sound_Player.increment_level`() in ms

Type

int

playing

Whether or not a sound is playing

Type

bool

_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

threading.Lock

Attributes:

severity_map

mapping between string representations of severities used by filenames and AlarmSeverity

staticMetaObject

Methods:

init_audio()

Load audio files in pvp/external/audio and add to Alarm_Sound_Player.idx

play()

Start sound playback

stop()

Stop sound playback

set_sound([severity, level])

Set sound to be played

increment_level()

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 to Alarm_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.

stop()[source]

Stop sound playback

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 play

  • level (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>
set_mute(mute: bool)[source]

Set mute state

Parameters

mute (bool) – if True, mute. if False, unmute.