Index: suite_leahi/shared/scripts/configuration/utility.py =================================================================== diff -u -r756aa59d442466b78609a9d4a9ae5fd9c1fbf2ef -rbddd2fe08aac52e286b53a811f0ab41919c7fea2 --- suite_leahi/shared/scripts/configuration/utility.py (.../utility.py) (revision 756aa59d442466b78609a9d4a9ae5fd9c1fbf2ef) +++ suite_leahi/shared/scripts/configuration/utility.py (.../utility.py) (revision bddd2fe08aac52e286b53a811f0ab41919c7fea2) @@ -4,6 +4,7 @@ import names from squish import * from leahi_dialin.ui import utils +from builtins import int as pyInt def get_object_from_names(names_dict, error_message = "Missing object", timeout_ms = 200): """ @@ -58,6 +59,16 @@ found = findObjectById(child, id) if found: return found + return None + +def findChildByText(parent_object, target_text): + """Recursively finds a child object by its text property.""" + for child in object.children(parent_object): + if hasattr(child, "text") and str(child.text) == target_text: + return child + found = findChildByText(child, target_text) + if found: + return found return None @@ -82,13 +93,14 @@ except LookupError: current_value = float(findObject(obj).property("value")) + # Determine direction while current_value != float(target_value): if current_value < float(target_value): squish.mouseClick(squish.waitForObject(right_arrow)) elif current_value > float(target_value): squish.mouseClick(squish.waitForObject(left_arrow)) - + # Update current value after click try: current_value = round(float(findObject(obj).value),1) except Exception: @@ -158,4 +170,4 @@ while findObject(object_name).value != 0.0: squish.mouseClick(waitForObject(left_arrow)) utils.waitForGUI(0.2) # Small delay to allow UI to update - \ No newline at end of file +