def setUp(self): compReg.initRegistry() # add a test registry self.behavior1 = EchoBehavior({'Id': 'behavior1'}) self.behavior2 = DebugBehavior({'Id': 'behavior2'}) compReg.registerComponent(self.behavior1) compReg.registerComponent(self.behavior2) self.switchBehavior = SwitchBehavior({'Id': 'switch', 'PrefixToBehavior': '{"@": "behavior1", "#": "behavior2"}', 'DefaultBehavior': 'behavior1'}) compReg.registerComponent(self.switchBehavior)
def setUp(self): compReg.initRegistry() # add a test registry self.behavior1 = EchoBehavior({'Id': 'behavior1'}) self.behavior2 = DebugBehavior({'Id': 'behavior2'}) compReg.registerComponent(self.behavior1) compReg.registerComponent(self.behavior2) self.switchBehavior = SwitchBehavior({ 'Id': 'switch', 'PrefixToBehavior': '{"@": "behavior1", "#": "behavior2"}', 'DefaultBehavior': 'behavior1' }) compReg.registerComponent(self.switchBehavior)
def __init__(self, configFileName): main_log.info("System Initialization began based on: " + str(configFileName)) self.timer = clock.Stopwatch() self.timer.start() self.inputs = {} # dict of inputs and their bound behaviors, keyed by InputId self.behaviors = {} self.lock = thread.allocate_lock() self.behaviorOutputs = {} # key: [list of output destinations] self.behaviorInputs = {} self.componentDict = {} self.inputBehaviorRegistry = {} # inputid -> behaviors listening to that self.dieNow = False # input self.screen = Screen() compReg.initRegistry() compReg.registerComponent(self.screen, "Screen") # TODO: move to constants file bqs.initBQS() # initialize the behavior query system # read configs from xml config = configGetter.loadConfigFile(configFileName) rendererConfig = config.find("RendererConfiguration") self.initializeRenderers(rendererConfig) pixelConfig = config.find("PixelConfiguration") self.initializeScreen(pixelConfig) inputConfig = config.find("InputConfiguration") self.initializeInputs(inputConfig) behaviorConfig = config.find("BehaviorConfiguration") self.initializeBehaviors(behaviorConfig) mapperConfig = config.find("PixelMapperConfiguration") self.initializeMapper(mapperConfig) # inits main_log.info("All components initialized") # self.registerAllComponents() installationConfig = config.find("InstallationConfiguration") self.configureInstallation(installationConfig) # Done initializing. Lets start this thing! self.timer.stop() # main_log.info('Initialization done. Time: ', self.timer.elapsed(), 'ms') self.mainLoop()
def __init__(self, configFileName): main_log.info("System Initialization began based on: " + str(configFileName)) self.timer = clock.Stopwatch() self.timer.start() self.inputs = {} #dict of inputs and their bound behaviors, keyed by InputId self.behaviors = {} self.lock = thread.allocate_lock() self.behaviorOutputs = {} #key: [list of output destinations] self.behaviorInputs = {} self.componentDict = {} self.inputBehaviorRegistry = {} #inputid -> behaviors listening to that self.dieNow = False #input self.screen = Screen() compReg.initRegistry() compReg.registerComponent(self.screen, 'Screen') #TODO: move to constants file bqs.initBQS() #initialize the behavior query system #read configs from xml config = configGetter.loadConfigFile(configFileName) rendererConfig = config.find('RendererConfiguration') self.initializeRenderers(rendererConfig) pixelConfig = config.find('PixelConfiguration') self.initializeScreen(pixelConfig) inputConfig = config.find('InputConfiguration') self.initializeInputs(inputConfig) behaviorConfig = config.find('BehaviorConfiguration') self.initializeBehaviors(behaviorConfig) mapperConfig = config.find('PixelMapperConfiguration') self.initializeMapper(mapperConfig) #inits main_log.info('All components initialized') # self.registerAllComponents() installationConfig = config.find('InstallationConfiguration') self.configureInstallation(installationConfig) #Done initializing. Lets start this thing! self.timer.stop() #main_log.info('Initialization done. Time: ', self.timer.elapsed(), 'ms') self.mainLoop()
def setUp(self): compReg.initRegistry()