Index: shared/scripts/configuration/utility.py =================================================================== diff -u -r32d23d68ca62013eeec4abdc7e09b2c9e3731f48 -r1de7a1d5daa737a8375b1e57174f7243c46e653c --- shared/scripts/configuration/utility.py (.../utility.py) (revision 32d23d68ca62013eeec4abdc7e09b2c9e3731f48) +++ shared/scripts/configuration/utility.py (.../utility.py) (revision 1de7a1d5daa737a8375b1e57174f7243c46e653c) @@ -7,6 +7,8 @@ # # @file utils.py # +# @author (last) Papiya Mandal +# @date (last) 21-Jan-2022 # @author (last) Joseph varghese # @date (last) 15-Jan-2022 # @@ -21,14 +23,15 @@ from dialin.ui import utils from builtins import int as pyInt from datetime import datetime +from dialin.ui.hd_simulator import HDSimulator + - def check_if_object_is_within_the_container(obj=None, container=None): """ check if an object is inside a container - @param obj - (obj) child UI object - @param container - (obj) container UI object - @return boolean true/false + @param obj - child UI object + @param container - container UI object + @return boolean true and false """ container = squish.findObject(container) containerPos = container.mapToGlobal(QPoint(0, 0)) @@ -45,14 +48,13 @@ return True return False - - + 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 + 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: @@ -74,6 +76,7 @@ raise LookupError("zone object is not in view to the user after " + \ "trying 100 times") + def pressure_pop_up_text_obj(text): names.o_pop_up_pressure_text_obj["text"] = text return names.o_pop_up_pressure_text_obj @@ -125,4 +128,39 @@ names.o_keypad_input["text"] = key_value return names.o_keypad_input - + +def scroll_to_value_on_pop_up(value=None, container=None): + """ + scroll to the to the value if object is hidden + @param value - value object + @param container - Container of the value + @return boolean true and false + """ + counter = 0 + while counter <= 100: + try: + counter += 1 + squish.findObject(value) + squish.snooze(0.5) + if check_if_object_is_within_the_container(obj=value, container=container): + return True + else: + raise RuntimeError + except RuntimeError: + ScreenObj = squish.waitForObject(container) + 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") + +def get_alarm_id_obj(id): + names.o_alarm_id["text"] = id + return names.o_alarm_id + +def get_alarm_msg_obj(msg): + names.o_alarm_message["text"] = msg + return names.o_alarm_message +