當前位置: 首頁>>代碼示例>>Python>>正文


Python ComponentRegistry.initRegistry方法代碼示例

本文整理匯總了Python中util.ComponentRegistry.initRegistry方法的典型用法代碼示例。如果您正苦於以下問題:Python ComponentRegistry.initRegistry方法的具體用法?Python ComponentRegistry.initRegistry怎麽用?Python ComponentRegistry.initRegistry使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在util.ComponentRegistry的用法示例。


在下文中一共展示了ComponentRegistry.initRegistry方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: setUp

# 需要導入模塊: from util import ComponentRegistry [as 別名]
# 或者: from util.ComponentRegistry import initRegistry [as 別名]
    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)
開發者ID:andychen,項目名稱:SmootLight,代碼行數:13,代碼來源:TestSwitchBehavior.py

示例2: __init__

# 需要導入模塊: from util import ComponentRegistry [as 別名]
# 或者: from util.ComponentRegistry import initRegistry [as 別名]
    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()
開發者ID:mboyd,項目名稱:SmootLight,代碼行數:49,代碼來源:LightInstallation.py

示例3: setUp

# 需要導入模塊: from util import ComponentRegistry [as 別名]
# 或者: from util.ComponentRegistry import initRegistry [as 別名]
 def setUp(self):
     compReg.initRegistry()
開發者ID:andychen,項目名稱:SmootLight,代碼行數:4,代碼來源:TestComponentRegistry.py


注:本文中的util.ComponentRegistry.initRegistry方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。