Exemple #1
0
 def configureInstallation(self, installationConfig):
     defaults = configGetter.generateArgDict(installationConfig.find('Defaults'))
     for defaultSelection in defaults:
         componentToMap = compReg.getComponent(defaults[defaultSelection])
         compReg.registerComponent(compReg.getComponent(defaults[defaultSelection]),\
             'Default'+defaultSelection)
         main_log.debug('Default Set: ' + defaultSelection + 'set to ' +\
             defaults[defaultSelection])
 def configureInstallation(self, installationConfig):
     defaults = configGetter.generateArgDict(installationConfig.find('Defaults'))
     for defaultSelection in defaults:
         componentToMap = compReg.getComponent(defaults[defaultSelection])
         compReg.registerComponent(compReg.getComponent(defaults[defaultSelection]),\
             'Default'+defaultSelection)
         main_log.debug('Default Set: ' + defaultSelection + 'set to ' +\
             defaults[defaultSelection])
Exemple #3
0
 def setUp(self):
     b = ColorChangerBehavior({'Id': 'color', 'ColorList': [(255, 0, 0)]})
     i = ContinuousCenterInput({
         'Id': 'center',
         'parentScope': self,
         'RefreshInterval': 500
     })
     compReg.registerComponent(b)
     compReg.registerComponent(i)
Exemple #4
0
 def inputInit(self):
     self.hostname = self.argDict['Hostname']
     self.port = int(self.argDict['Port'])
     compReg.registerComponent(self, 'Webserver')
     
     urls = ('/(.*)', 'WebHandler')
     env = globals()
     env['sys'].argv = []
     app = web.application(urls, env)
     
     self.server_thread = threading.Thread(target=app.run)
     self.server_thread.daemon = True
     self.server_thread.start()
     
     webbrowser.open('http://'+self.hostname+':'+str(self.port))
    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()
Exemple #6
0
    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()
Exemple #7
0
 def setUp(self):
     s = Screen()
     compReg.registerComponent(s, 'Screen')
     
     b = ColorChangerBehavior({'Id': 'color','ColorList':[(255,0,0)]})
     i = ContinuousCenterInput({'Id': 'center','parentScope':self,'RefreshInterval':500})
     
     compReg.registerComponent(b)
     compReg.registerComponent(i)
    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 test_register_new_id(self):
     comp = SmootCoreObject({})
     cid = compReg.registerComponent(comp)
     newcomp = compReg.getComponent(cid)
     assert comp == newcomp
Exemple #11
0
 def appendBehavior(behavior):
     bid = compReg.registerComponent(
         behavior)  #register behavior (will make
     #a new id if there isn't one)
     self['ChainedBehaviors'].append(bid)
 def test_register_new_id(self):
     comp = SmootCoreObject({})
     cid =compReg.registerComponent(comp)
     newcomp = compReg.getComponent(cid)
     assert comp == newcomp
 def test_register_component_id_specified(self):
     comp = SmootCoreObject({'Id': 'obj1'})
     compReg.registerComponent(comp)
     newcomp = compReg.getComponent('obj1')
     assert comp == newcomp
 def registerComponents(self, components):
     for component in components:
         cid = compReg.registerComponent(component)
         main_log.info(cid + ' registered')
         compReg.registerComponent(component)
         main_log.info(cid + ' registered')
Exemple #15
0
 def registerComponents(self, components):
     for component in components:
         cid = compReg.registerComponent(component)
         if cid == None:
             raise Exception('Null component Id.  ComponentRegistry not fuctioning as expected.')
         main_log.info(cid + ' registered')
 def test_register_component_id_specified(self):
     comp = SmootCoreObject({'Id': 'obj1'})
     compReg.registerComponent(comp)
     newcomp = compReg.getComponent('obj1')
     assert comp == newcomp
Exemple #17
0
 def configureInstallation(self, installationConfig):
     defaults = configGetter.generateArgDict(installationConfig.find("Defaults"))
     for defaultSelection in defaults:
         componentToMap = compReg.getComponent(defaults[defaultSelection])
         compReg.registerComponent(compReg.getComponent(defaults[defaultSelection]), "Default" + defaultSelection)
         main_log.debug("Default Set: " + defaultSelection + "set to " + defaults[defaultSelection])
Exemple #18
0
 def appendBehavior(behavior):
     bid = compReg.registerComponent(behavior) #register behavior (will make
     #a new id if there isn't one)
     self['ChainedBehaviors'].append(bid)