def __doLoadView(self, alias, name, *args, **kwargs): viewTutorialID = self.__app.tutorialManager.getViewTutorialID(name) if name in self.__nameToLoadingItem: item = self.__nameToLoadingItem[name] viewDict = { 'config': item.pyEntity.settings.getDAAPIObject(), 'alias': alias, 'name': name, 'viewTutorialId': viewTutorialID } self.as_loadViewS(viewDict) return item.pyEntity else: pyEntity, factoryIdx = g_entitiesFactories.factory( alias, *args, **kwargs) if pyEntity is not None: pyEntity.setUniqueName(name) pyEntity.setEnvironment(self.__app) self.__nameToLoadingItem[name] = _LoadingItem( name, pyEntity, factoryIdx, args, kwargs) self.onViewLoadInit(pyEntity) viewDict = { 'config': pyEntity.settings.getDAAPIObject(), 'alias': alias, 'name': name, 'viewTutorialId': viewTutorialID } self.as_loadViewS(viewDict) return pyEntity LOG_WARNING('PyEntity for alias %s is None' % alias) return return
def __doLoadSFView(self, loadParams, *args, **kwargs): key = loadParams.viewKey viewTutorialID = self.__app.tutorialManager.getViewTutorialID(key.name) pyEntity = None if key in self.__loadingItems: item = self.__loadingItems[key] item.isCancelled = False if not item.pyEntity.isDisposed(): pyEntity = item.pyEntity if pyEntity is not None: pyEntity.onDispose += self.__handleViewDispose viewDict = {'config': pyEntity.settings.getDAAPIObject(), 'alias': key.alias, 'name': key.name, 'viewTutorialId': viewTutorialID} self.as_loadViewS(viewDict) else: pyEntity, factoryIdx = g_entitiesFactories.factory(key.alias, *args, **kwargs) if pyEntity is not None: pyEntity.setUniqueName(key.name) pyEntity.setEnvironment(self.__app) pyEntity.onDispose += self.__handleViewDispose config = pyEntity.settings.getDAAPIObject() self.__loadingItems[key] = _LoadingItem(loadParams, pyEntity, factoryIdx, args, kwargs, config.get('isModal', False)) self.onViewLoadInit(pyEntity) viewDict = {'config': config, 'alias': key.alias, 'name': key.name, 'viewTutorialId': viewTutorialID} self.as_loadViewS(viewDict) else: _logger.warning('PyEntity for alias %s is None', key.alias) return pyEntity
def registerFlashComponent(self, component, alias, *args): from gui.Scaleform.framework import g_entitiesFactories componentPy, idx = g_entitiesFactories.factory(alias, *args) if componentPy is not None: componentPy = g_entitiesFactories.initialize( componentPy, component, idx) else: LOG_ERROR('Component %s not found in python'.format(alias), alias) return if not isinstance(componentPy, BaseDAAPIModule): LOG_ERROR( 'registered component {0} should extend a BaseDAAPIModule class!' .format(str(componentPy))) return else: if alias in self.__components.keys(): LOG_WARNING( 'Class with alias `%s` already registered in object %s. It will be rewritten.' % (alias, str(self))) self.__components[alias] = componentPy componentPy.setEnvironment(self.app) componentPy.create() self.__fireRegisteringEvent(ComponentEvent.COMPONENT_REGISTERED, componentPy, alias) self._onRegisterFlashComponent(componentPy, alias) return
def registerFlashComponent(self, component, alias, *args): from gui.Scaleform.framework import g_entitiesFactories componentPy, idx = g_entitiesFactories.factory(alias, *args) if componentPy is not None: componentPy = g_entitiesFactories.initialize( componentPy, component, idx) else: _logger.error('Component %s not found in python', alias) return if not isinstance(componentPy, BaseDAAPIModule): _logger.error( 'Registered component %r should extend a BaseDAAPIModule class!', componentPy) return else: if alias in self.__components.keys(): _logger.warning( 'Class with alias `%s` already registered in object %r. It will be rewritten.', alias, self) self.__components[alias] = componentPy componentPy.setEnvironment(self.app) componentPy.create() self.__fireRegisteringEvent( events.ComponentEvent.COMPONENT_REGISTERED, componentPy, alias) self._onRegisterFlashComponent(componentPy, alias) return
def __doLoadView(self, alias, name, *args, **kwargs): viewTutorialID = self.__app.tutorialManager.getViewTutorialID(name) if name in self.__nameToLoadingItem: item = self.__nameToLoadingItem[name] viewDict = {'config': item.pyEntity.settings.getDAAPIObject(), 'alias': alias, 'name': name, 'viewTutorialId': viewTutorialID} self.as_loadViewS(viewDict) return item.pyEntity else: pyEntity, factoryIdx = g_entitiesFactories.factory(alias, *args, **kwargs) if pyEntity is not None: pyEntity.setUniqueName(name) pyEntity.setEnvironment(self.__app) self.__nameToLoadingItem[name] = _LoadingItem(name, pyEntity, factoryIdx, args, kwargs) self.onViewLoadInit(pyEntity) viewDict = {'config': pyEntity.settings.getDAAPIObject(), 'alias': alias, 'name': name, 'viewTutorialId': viewTutorialID} self.as_loadViewS(viewDict) return pyEntity LOG_WARNING('PyEntity for alias %s is None' % alias) return return
def __loadViewForToken(self, alias, name, token, *args, **kwargs): if token in self.__tokens: item = self.__tokens[token] self.as_loadViewS(item.pyEntity.settings._asdict(), token, alias, name) else: pyEntity, factoryIdx = g_entitiesFactories.factory(alias, *args, **kwargs) if pyEntity is not None: self.__tokens[token] = _TokenItem(name, pyEntity, factoryIdx, args, kwargs) self.onViewLoadInit(pyEntity) self.as_loadViewS(pyEntity.settings._asdict(), token, alias, name) return
def __loadViewForToken(self, alias, name, token, *args, **kwargs): if token in self.__tokens: item = self.__tokens[token] self.as_loadViewS(item.pyEntity.settings._asdict(), token, alias, name) else: pyEntity, factoryIdx = g_entitiesFactories.factory( alias, *args, **kwargs) if pyEntity is not None: self.__tokens[token] = _TokenItem(name, pyEntity, factoryIdx, args, kwargs) self.onViewLoadInit(pyEntity) self.as_loadViewS(pyEntity.settings._asdict(), token, alias, name) return
def __doLoadView(self, alias, name, *args, **kwargs): if name in self.__nameToLoadingItem: item = self.__nameToLoadingItem[name] self.as_loadViewS(item.pyEntity.settings._asdict(), alias, name) return item.pyEntity else: pyEntity, factoryIdx = g_entitiesFactories.factory(alias, *args, **kwargs) if pyEntity is not None: pyEntity.setUniqueName(name) self.__nameToLoadingItem[name] = _LoadingItem(name, pyEntity, factoryIdx, args, kwargs) self.onViewLoadInit(pyEntity) self.as_loadViewS(pyEntity.settings._asdict(), alias, name) return pyEntity LOG_WARNING('PyEntity for alias %s is None' % alias) return return
def registerFlashComponent(self, component, alias, *args): from gui.Scaleform.framework import g_entitiesFactories componentPy, idx = g_entitiesFactories.factory(alias, *args) if componentPy is not None: componentPy = g_entitiesFactories.initialize(componentPy, component, idx) else: LOG_ERROR('Component %s not found in python'.format(alias), alias) return if not isinstance(componentPy, BaseDAAPIComponent): LOG_ERROR('registered component {0} should extend a BaseDAAPIComponent class!'.format(str(componentPy))) return if alias in self.__components.keys(): LOG_WARNING('Class with alias `%s` already registered in object %s.\t\t\t\tIt will be rewritten.' % (alias, str(self))) self.__components[alias] = componentPy componentPy.seEnvironment(self.app) componentPy.create() self.__fireRegisteringEvent(ComponentEvent.COMPONENT_REGISTERED, componentPy, alias) self._onRegisterFlashComponent(componentPy, alias)
def __doLoadView(self, alias, name, *args, **kwargs): viewTutorialID = self.__app.tutorialManager.getViewTutorialID(alias) if name in self.__nameToLoadingItem: item = self.__nameToLoadingItem[name] self.as_loadViewS(item.pyEntity.settings._asdict(), alias, name, viewTutorialID) return item.pyEntity else: pyEntity, factoryIdx = g_entitiesFactories.factory(alias, *args, **kwargs) if pyEntity is not None: pyEntity.setUniqueName(name) pyEntity.seEnvironment(self.__app) self.__nameToLoadingItem[name] = _LoadingItem(name, pyEntity, factoryIdx, args, kwargs) self.onViewLoadInit(pyEntity) self.as_loadViewS(pyEntity.settings._asdict(), alias, name, viewTutorialID) return pyEntity LOG_WARNING("PyEntity for alias %s is None" % alias) return return
def registerFlashComponent(self, component, alias, *args): from gui.Scaleform.framework import g_entitiesFactories componentPy, idx = g_entitiesFactories.factory(alias, *args) if componentPy is not None: componentPy = g_entitiesFactories.initialize(componentPy, component, idx) else: LOG_ERROR('Component not found in python', alias) return from gui.Scaleform.framework.entities.View import View if isinstance(componentPy, View): LOG_ERROR('registered component {0} can`t extend a View class. It must be DAAPIModule only!'.format(str(componentPy))) return if alias in self.__components.keys(): LOG_WARNING('Class with alias `%s` already registered in object %s.\t\t\t\tIt will be rewritten.' % (alias, str(self))) self.__components[alias] = componentPy componentPy.create() self.__fireRegisteringEvent(ComponentEvent.COMPONENT_REGISTERED, componentPy, alias) self._onRegisterFlashComponent(componentPy, alias)
def __doLoadView(self, alias, name, *args, **kwargs): viewTutorialID = self.__app.tutorialManager.getViewTutorialID(alias) if name in self.__nameToLoadingItem: item = self.__nameToLoadingItem[name] self.as_loadViewS(item.pyEntity.settings._asdict(), alias, name, viewTutorialID) return item.pyEntity else: pyEntity, factoryIdx = g_entitiesFactories.factory( alias, *args, **kwargs) if pyEntity is not None: pyEntity.setUniqueName(name) pyEntity.seEnvironment(self.__app) self.__nameToLoadingItem[name] = _LoadingItem( name, pyEntity, factoryIdx, args, kwargs) self.onViewLoadInit(pyEntity) self.as_loadViewS(pyEntity.settings._asdict(), alias, name, viewTutorialID) return pyEntity LOG_WARNING('PyEntity for alias %s is None' % alias) return
def registerFlashComponent(self, component, alias, *args): from gui.Scaleform.framework import g_entitiesFactories componentPy, idx = g_entitiesFactories.factory(alias, *args) if componentPy is not None: componentPy = g_entitiesFactories.initialize( componentPy, component, idx) else: LOG_ERROR('Component not found in python', alias) return from gui.Scaleform.framework.entities.View import View if isinstance(componentPy, View): LOG_ERROR( 'registered component {0} can`t extend a View class. It must be DAAPIModule only!' .format(str(componentPy))) return else: if alias in self.__components.keys(): LOG_WARNING( 'Class with alias `%s` already registered in object %s.\t\t\t\tIt will be rewritten.' % (alias, str(self))) self.__components[alias] = componentPy componentPy.create() self._onRegisterFlashComponent(componentPy, alias) return