Index: shared/scripts/configuration/utility.py =================================================================== diff -u -r7883bcc9c71da71d09d48d8998a99a9b8ad0640a -ref981744e6899b22a40fef4a8d74db9a4e930575 --- shared/scripts/configuration/utility.py (.../utility.py) (revision 7883bcc9c71da71d09d48d8998a99a9b8ad0640a) +++ shared/scripts/configuration/utility.py (.../utility.py) (revision ef981744e6899b22a40fef4a8d74db9a4e930575) @@ -169,33 +169,34 @@ test.compare(str(input_field.text), "", "Input field should be empty") test.endSection() -def scroll_to_zone(zone=None, screen_object=None, direction = None): +def scroll_to_zone(targetObject=None, screen_object=None, direction = None, yDegreeScrollDisplace = 20): """ scroll to the to the value if object is hidden - @param value - (obj) value object - @param container - (obj) Container of the value + @param targetObject - (obj) value object + @param screen_object - (obj) Container of the value + @param direction: None indicate a horizontal direction, anything else a vertical direction + @param yDegreeScrollDisplace: The amount of degrees in the y direction to scroll @return boolean true and false """ counter = 0 + + # Figure out the screen's dimensions + ScreenObj = squish.findObject(screen_object) + screenHeight = pyInt(ScreenObj.height) + screenWidth = pyInt(ScreenObj.width) + while counter <= 100: - try: - counter += 1 - squish.findObject(zone) - squish.snooze(0.5) - if check_if_object_is_within_the_container(obj=zone, container=screen_object): - return True - else: - raise RuntimeError - except RuntimeError: - ScreenObj = squish.findObject(screen_object) - screenHeight = pyInt(ScreenObj.height) - screenWidth = pyInt(ScreenObj.width) + counter += 1 + squish.findObject(targetObject) + squish.snooze(0.5) + if check_if_object_is_within_the_container(obj=targetObject, container=screen_object): + return True + else: if direction is None: - squish.mouseWheel(ScreenObj, (screenWidth-100), 107, 0, -(screenHeight-460), squish.Qt.NoModifier) + squish.mouseWheel(ScreenObj, (screenWidth-100), 107, 0, -yDegreeScrollDisplace, squish.Qt.NoModifier) else: - squish.mouseWheel(ScreenObj, (screenWidth-100), -(screenHeight-700), 0, 200, squish.Qt.NoModifier) - - raise LookupError("zone object is not in view to the user after trying 100 times") + squish.mouseWheel(ScreenObj, (screenWidth-100), -(screenHeight-700), 0, yDegreeScrollDisplace, squish.Qt.NoModifier) + raise LookupError("targetObject object is not in view to the user after trying 100 times") def get_alarm_id_obj(id):