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: if "MCM" in deviceName:
Docked_East_View = Docked_East_Map["MCM"] Docked_East_View = Docked_East_Map["MCM"]
components = view.rootContainer.getChildren() components = view.rootContainer.getChildren()[0].getChildren()
priority = parts[1] priority = parts[1]
foundMatch = False foundMatch = False
# clear all highlights and apply new one when found # clear all highlights and apply new one when found
for child in components: for child in components:
params = child.props.get("params", {}) params = child.props.get("params", {})

View File

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