35 lines
1.2 KiB
Plaintext
35 lines
1.2 KiB
Plaintext
def show_alarm_from_docked_window(self,event):
|
|
#Get the alarm properties from the alarm object.
|
|
"""
|
|
Displays the currently active alarm from the south docked alarm table in the detailed view.
|
|
If the alarm is on a different page to the current page the function will navigate the user
|
|
to the correct page and show the alarm.
|
|
|
|
Args:
|
|
self: Refrence to the object thats invoking this function.
|
|
event: Refrence to the event that is invoking this function.
|
|
|
|
Returns:
|
|
The fucntion doses not return any values.
|
|
|
|
Raises:
|
|
KeyError: None
|
|
"""
|
|
|
|
|
|
alarm_id = event.value.get("AlarmId")
|
|
tags_to_read = system.tag.readBlocking(["System/ActiveAlarms"])
|
|
active_alarms = system.util.jsonDecode(tags_to_read[0].value)
|
|
UDT = active_alarms.get(alarm_id,{}).get("UDT_tag")
|
|
plc = UDT.split("_")[0]
|
|
name = active_alarms.get(alarm_id,{}).get("Name")
|
|
page_id = active_alarms.get(alarm_id,{}).get("PageId","None")
|
|
display_path = active_alarms.get(alarm_id,{}).get("DisplayPath")
|
|
|
|
#Set the session custom variables to highlight the selected alarm.
|
|
self.session.custom.searchId = UDT
|
|
self.session.custom.deviceSearchId = display_path
|
|
|
|
url_to_navigate = "/DetailedView/%s/%s" % (page_id, plc)
|
|
system.perspective.navigate(page = url_to_navigate)
|