Updated search codes to reflect changes of the view structure changes from the rotation

This commit is contained in:
Salijoghli 2025-08-27 13:38:14 +04:00
parent df06877bb5
commit d9e38e645f
2 changed files with 16 additions and 8 deletions

View File

@ -24,12 +24,12 @@ def handleTagHighlight(view, currentValue):
if "MCM" in deviceName:
Docked_East_View = Docked_East_Map["MCM"]
components = view.rootContainer.getChildren()
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", {})

View File

@ -5,8 +5,8 @@ global_project_page_ids = {}
def get_project_config():
"""
Scan each view.json under Detailed_Views (no recursion),
read top-level children, extract tagProps[0],
and store as {source_id: view_folder_name}.
go one level deeper (coordinateContainer), extract tagProps[0]
from children, and store as {source_id: view_folder_name}.
"""
global global_project_page_ids
global_project_page_ids.clear()
@ -21,7 +21,7 @@ def get_project_config():
)
if not os.path.exists(base_path):
system.perspective.print("Path not found: " + base_path)
system.perspective.print("Path not found: " + base_path)
return {}
for view_folder in os.listdir(base_path):
@ -32,8 +32,16 @@ def get_project_config():
with open(json_file, "r") as fh:
view_json = json.load(fh)
# only top-level children
children = (view_json.get("root") or {}).get("children") or []
# go one level deeper: root -> children[0] (coordinateContainer) -> its children
root_children = (view_json.get("root") or {}).get("children") or []
if not root_children:
continue
# assume first child is the coordinateContainer
container = root_children[0]
children = container.get("children") or []
# now loop through these children to get tagProps
for child in children:
props = child.get("props") or {}
params = props.get("params") or {}
@ -42,7 +50,7 @@ def get_project_config():
if isinstance(tag_props, list) and len(tag_props) > 0:
source_id = str(tag_props[0])
global_project_page_ids[source_id] = view_folder
system.perspective.print("Found: {} -> {}".format(source_id, view_folder))
except:
whid = system.tag.readBlocking("Configuration/FC")[0].value