BNA8/.resources/bc4c9e6d6533e706d36e68909381a5d9efb94ba271c7e414eaf29143395e99f9
2025-09-19 17:47:58 +04:00

59 lines
1.4 KiB
Plaintext

def deviceType(view):
path = view.props.get("path")
docked_view = "Docked-East-"
if "Conveyor" in path:
docked_view +="Conv"
elif "VFD" in path:
docked_view +="VFD"
else :
docked_view +="Device"
return docked_view
def handleTagHighlight(view, currentValue):
tag_priority = currentValue.value
# --- CASE 1: Remove all highlights by applying CLEAR class ---
if not tag_priority or str(tag_priority).upper() == "CLEAR":
for child in view.rootContainer.getChildren()[0].getChildren():
try:
child.props.style.classes = ""
except:
pass
return False
parts = str(tag_priority).split("||")
tag = parts[0]
splitedTag = tag.split("/")
deviceName = splitedTag[-1]
components = view.rootContainer.getChildren()[0].getChildren()
priority = parts[1]
foundMatch = False
# clear all highlights and apply new one when found
for child in components:
params = child.props.get("params", {})
tagProps = params.get("tagProps", {})
tagsList = list(tagProps)
if len(tagsList) == 0:
continue
child.props.style.classes = ""
tagPath = tagsList[0]
# system.perspective.print(tagPath)
if tag == tagPath:
child.props.style["classes"] = "Highlight/Pulse-" + priority
docked_view = deviceType(child)
system.perspective.openDock(docked_view, params={'tagProps': tagProps})
foundMatch = True
return foundMatch