Index: shared/scripts/configuration/utility.py =================================================================== diff -u -rcba889b06ffd1acf3d26a46fb852bfaf86af36cb -r4c3783ae2fafb0cd91a66c648f8ccfc78174db86 --- shared/scripts/configuration/utility.py (.../utility.py) (revision cba889b06ffd1acf3d26a46fb852bfaf86af36cb) +++ shared/scripts/configuration/utility.py (.../utility.py) (revision 4c3783ae2fafb0cd91a66c648f8ccfc78174db86) @@ -22,6 +22,7 @@ import test from builtins import int as pyInt +from builtins import str as pyStr from builtins import format from configuration import config from dialin.ui import utils @@ -36,38 +37,13 @@ def color_verification(exp_val = "Red", act_val = "#c53b33"): test.compare(config.COLOR_CODES[color_name],(act_val.color[name])) - -def scroll_to_zone(zone=None, screen_object=None): - """ - scroll to the numeric if object is hidden - @param zone - UI object - @param screen_object - UI object (UI Home screen = waveforms + numerics) - @return boolean true/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 check_if_object_is_within_the_container(obj=None, container=None): """ - check if an object is inside a container - @param obj - child UI object - @param container - container UI object - @return boolean + check if an object is inside a container + @param obj - child UI object + @param container - container UI object + @return boolean True/False """ container = squish.findObject(container) containerPos = container.mapToGlobal(squish.QPoint(0, 0)) @@ -161,10 +137,10 @@ def scroll_to_zone(zone=None, screen_object=None, direction = None): """ - scroll to the to the value if object is hidden - @param value - (obj) value object - @param container - (obj) Container of the value - @return boolean true and false + scroll to the numeric if object is hidden + @param zone - UI object + @param screen_object - UI object (UI Home screen = waveforms + numerics) + @return boolean True/False """ counter = 0 while counter <= 100: @@ -180,6 +156,7 @@ 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: @@ -239,35 +216,6 @@ names.o_keypad_input["text"] = key_value return names.o_keypad_input - -def scroll_to_zone(zone=None, screen_object=None, direction = None): - """ - scroll to the to the value if object is hidden - @param value - (obj) value object - @param container - (obj) Container of the value - @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.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-700), 0, 200, 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