40 lines
896 B
Python

def handleTagHighlight(view, currentValue):
tag = currentValue.value
if tag == "":
return
splitedTag = str(tag).split("/")
deviceName = splitedTag[-1]
Docked_East_Map = {
"VFD" : "Docked-East-VFD",
"MCM" : "Docked-East-MCM"
}
Docked_East_View = Docked_East_Map["VFD"]
if "PE" in deviceName:
tag = "/".join(splitedTag[:2]) + "/Conveyor/" + deviceName[:-3] + "VFD1"
if "MCM" in deviceName:
Docked_East_View = Docked_East_Map["MCM"]
components = view.rootContainer.getChildren()
for child in components:
params = child.props.get("params", {})
tagProps = params.get("tagProps", {})
tagsList = list(tagProps)
if len(tagsList) == 0:
continue
tagPath = tagsList[0]
if tag == tagPath:
child.props.style["classes"] = "Highlight/Pulse"
system.perspective.openDock(Docked_East_View, params={'tagProps': tagProps})
return True
return False