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 viewLoaded(self, alias, name, gfxEntity): viewKey = ViewKey(alias, name) if viewKey in self.__loadingItems: item = self.__loadingItems.pop(viewKey) if item.isCancelled or item.pyEntity.isDisposed(): self.onViewLoadCanceled(viewKey, item) else: pyEntity = g_entitiesFactories.initialize( item.pyEntity, gfxEntity, item.factoryIdx, extra={'name': item.name}) item.pyEntity.onDispose -= self.__handleViewDispose if pyEntity is not None: pyEntity.getParentWindow().setViewLoaded() self.onViewLoaded(pyEntity, item.loadParams) else: msg = 'An error occurred before view initialization. View {} will be destroyed.'.format( item.pyEntity) _logger.error(msg) if not item.pyEntity.isDisposed(): item.pyEntity.destroy() self.onViewLoadError(viewKey, msg, item) else: _logger.error('View loading for key has no associated data: %r', viewKey) 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, 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 viewLoaded(self, alias, name, gfxEntity): """ Callback to be invoked by AS when a view is loaded. :param alias: value of view alias. :param name: name of view. :param gfxEntity: GFXEntity (AS entity) instance. """ viewKey = ViewKey(alias, name) if viewKey in self.__loadingItems: item = self.__loadingItems.pop(viewKey) if item.isCancelled: self.onViewLoadCanceled(viewKey, item) else: pyEntity = g_entitiesFactories.initialize( item.pyEntity, gfxEntity, item.factoryIdx, extra={'name': item.name}) item.pyEntity.onDispose -= self.__handleViewDispose if pyEntity is not None: self.onViewLoaded(pyEntity, item.loadParams) else: msg = 'An error occurred before DAAPI initialization. View {} will be destroyed.'.format( item.pyEntity) LOG_ERROR(msg) if not item.pyEntity.isDisposed(): item.pyEntity.destroy() self.onViewLoadError(viewKey, msg, item) else: LOG_ERROR('View loading for key has no associated data', viewKey) return
def viewLoaded(self, name, gfxEntity): if name in self.__nameToLoadingItem: item = self.__nameToLoadingItem.pop(name) pyEntity = g_entitiesFactories.initialize(item.pyEntity, gfxEntity, item.factoryIdx, extra={'name': item.name}) if pyEntity is not None: self.onViewLoaded(pyEntity) else: LOG_ERROR('Error during until DAAPI initializing.') else: LOG_ERROR('View load for name has no associated data', name)
def viewLoaded(self, token, gfxEntity): if token in self.__tokens: item = self.__tokens.pop(token) pyEntity = g_entitiesFactories.initialize(item.pyEntity, gfxEntity, item.factoryIdx, extra={'name': item.name, 'token': token}) if pyEntity is not None: self.onViewLoaded(pyEntity) else: LOG_ERROR('Error during until DAAPI initializing.') else: LOG_ERROR('View load for token has no associated data', token)
def viewLoaded(self, name, gfxEntity): if name in self.__nameToLoadingItem: item = self.__nameToLoadingItem.pop(name) pyEntity = g_entitiesFactories.initialize( item.pyEntity, gfxEntity, item.factoryIdx, extra={'name': item.name}) if pyEntity is not None: self.onViewLoaded(pyEntity) else: LOG_ERROR('Error during until DAAPI initializing.') else: LOG_ERROR('View load for name has no associated data', name)
def viewLoaded(self, token, gfxEntity): if token in self.__tokens: item = self.__tokens.pop(token) pyEntity = g_entitiesFactories.initialize(item.pyEntity, gfxEntity, item.factoryIdx, extra={ 'name': item.name, 'token': token }) if pyEntity is not None: self.onViewLoaded(pyEntity) else: LOG_ERROR('Error during until DAAPI initializing.') else: LOG_ERROR('View load for token has no associated data', token) 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 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 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