########################################################################### # # Copyright (c) 2019-2021 Diality Inc. - All Rights Reserved. # # THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN # WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. # # @file utils.py # @author (last) LTTS # @date (last) 15-Jan-2022 # ############################################################################ import csv import glob import names import object import squish import shutil import test import re import builtins from builtins import format from builtins import str as pyStr from builtins import int as pyInt from leahi_dialin.ui import utils from leahi_dialin.utils import * from datetime import timezone from datetime import datetime def get_object_from_names(names_dict, error_message = "Missing object", timeout_ms = 200): """ To get an object with try..except catching to prevent script errors when the object is not found on the GUI @param names_dict - the dictionary element from the names.py file (ie: names.some_variable_name_of_element) @returns the object with corresponding dictionary, otherwise "None" """ try: return squish.waitForObject(names_dict, timeout_ms) except LookupError: test.fail("ERROR : " + error_message) return None def pressure_text_obj(text): names.pressure_text_obj["text"] = text return names.pressure_text_obj