Index: suite_leahi/shared/scripts/configuration/utility.py =================================================================== diff -u -rc7d96b722594bb29a7bbc3689715b90af6e3d616 -rb0ef2e099ea10d4ec265b06bd6c0325630f69a58 --- suite_leahi/shared/scripts/configuration/utility.py (.../utility.py) (revision c7d96b722594bb29a7bbc3689715b90af6e3d616) +++ suite_leahi/shared/scripts/configuration/utility.py (.../utility.py) (revision b0ef2e099ea10d4ec265b06bd6c0325630f69a58) @@ -9,6 +9,13 @@ td =TD_Messaging() from leahi_dialin.ui import utils from builtins import int as pyInt + +def aut(*args): + """ + Joins the executable name and argument + into a single command string + """ + return " ".join(('leahi', *args)) def get_object_from_names(names_dict, error_message = "Missing object", timeout_ms = 200): """ @@ -73,7 +80,26 @@ found = findChildByText(child, target_text) if found: return found - + + return None + +def findAllObjectsById(parent, target_id): + """ + Recursively finds all child objects by their id property. + Returns a list of all matching objects found. + """ + results = [] + + # Use hasattr to safely check for 'id' property + if hasattr(parent, 'id') and str(parent.id) == target_id: + results.append(parent) + + # Recurse through all children to collect all instances + for child in object.children(parent): + results.extend(findAllObjectsById(child, target_id)) + + return results + def set_value_based_on_target(obj, target_value): """ obj: dictionary containing object paths @@ -242,6 +268,17 @@ utils.waitForGUI(0.2) # Small delay to allow UI to update return None + +def get_row_object(screen_obj, num): + """ + To obtain a row object based on occurrence provided. + @param screen_obj: provides the container on which the row must be present + @param num: provides the occurrence value (0-based index) + @returns a real name object + """ + names.o_Row_Object["container"] = screen_obj + names.o_Row_Object["occurrence"] = num + 1 + return names.o_Row_Object def get_object_color(names_dict, error_message = "Missing object color", timeout_ms = 2000): """ @@ -251,7 +288,6 @@ """ try: return squish.waitForObject(names_dict, timeout_ms).color.name - except LookupError: test.fail("ERROR : " + error_message) return None