Index: shared/scripts/configuration/utility.py =================================================================== diff -u -rc7b85cd6de64cdd4c730624e5321b723c4ff0ee7 -rce5a0db0c7033fbf15d8725a4e9973372a611c92 --- shared/scripts/configuration/utility.py (.../utility.py) (revision c7b85cd6de64cdd4c730624e5321b723c4ff0ee7) +++ shared/scripts/configuration/utility.py (.../utility.py) (revision ce5a0db0c7033fbf15d8725a4e9973372a611c92) @@ -46,31 +46,6 @@ return False -def scroll_to_zone(zone=None, screen_object=None): - """ - scroll to the zone if object is hidden - @param zone - (obj) UI object - @param screen_object - (obj) UI object - @return boolean true and false - """ - counter = 0 - 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.waitForObject(screen_object) - screenHeight = pyInt(ScreenObj.height) - screenWidth = pyInt(ScreenObj.width) - squish.mouseWheel(ScreenObj, screenWidth-1000, screenHeight-10, 0, -50, squish.Qt.NoModifier) - raise LookupError("zone object is not in view to the user after trying 100 times") - - def get_alarm_id_obj(id): names.o_alarm_id["text"] = id return names.o_alarm_id @@ -115,4 +90,39 @@ screenHeight = pyInt(ScreenObj.height) screenWidth = pyInt(ScreenObj.width) squish.mouseWheel(ScreenObj, screenWidth//2, screenHeight//2, 0, -50, squish.Qt.NoModifier) - raise LookupError("value object is not in view to the user after trying 100 times") \ No newline at end of file + raise LookupError("value object is not in view to the user after trying 100 times") + + +def scroll_to_zone(zone=None, screen_object=None, direction = None): + """ + scroll to the UI, if object is hidden + @param zone - object to be find out. + @param screen_object - object of the screen. + @return boolean + """ + counter = 0 + 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) + if direction is None: + squish.mouseWheel(ScreenObj, (screenWidth-100), + 107, 0, -(screenHeight-460), squish.Qt.NoModifier) + else: + squish.mouseWheel(ScreenObj, (screenWidth-100), + -(screenHeight-780), 0, 200, squish.Qt.NoModifier) + + raise LookupError("zone object is not in view to the user after " + \ + "trying 100 times") + + +