def test_optional_set_value(signature, value): prop = qi.Property(signature) prop.setValue(value) actual = prop.value() def isclose(a, b, rel_tol=1e-09, abs_tol=0.0): return abs(a - b) <= max(rel_tol * max(abs(a), abs(b)), abs_tol) assert actual == value or isclose(actual, value, rel_tol=1e-6)
def __init__(self, session=None): self._session = session self._module_name = self.__class__.__name__ self.__name__ = self._module_name self._logger = qi.Logger(self._module_name) self._logger.info(":::: Starting {} ::::".format(self._module_name)) self._pref_domain = "tool.applauncher" # @TODO: "com.sbr.apps.app-launcher" # public variables self._logger.info("Initializing public variables...") self.current_state = qi.Property("s") self.current_state.setValue("") self.current_page = qi.Property("s") self.current_page.setValue("Home") self.apps_full_list = qi.Property() self.apps_full_list.setValue({}) self.pages_definition = qi.Property() self.pages_definition.setValue({}) self.autonomous_enabled = qi.Property("b") self.autonomous_enabled.setValue(True) self.display_app_name = qi.Property("b") self.display_app_name.setValue(True) self.ping_required = qi.Signal("(i)") # internal variables self._logger.info("Initializing internal variables...") self._app_uuid = helpers.find_app_name(self._logger) self._current_app = "" self._preferences_manager = PreferencesManager(self._logger, self._session, self._pref_domain) self._app_list_manager = AppListManager(self._logger, self._session, self._preferences_manager, self._app_uuid, self.apps_full_list, self.pages_definition) self._view_manager = ViewManager(self._logger, self._session, self._preferences_manager, self._app_uuid, self.current_state, self.ping_required) self._dialog_manager = DialogManager(self._logger, self._session, self._preferences_manager, self.pages_definition, self.autonomous_enabled, self.current_page) _pref_display_app_name = self._preferences_manager.get_value('behaviorNameDisplayed', True) if _pref_display_app_name: self.display_app_name.setValue(True) else: self.display_app_name.setValue(False) self._logger.info(":::: Ready! ::::")
def __init__(self): self.signal = qi.Signal() self.property = qi.Property() self.property.setValue(42)