def __init__(self, params, parentId = 0, indexId = 0):
		self.params = utils.extendSettings(self.defaultParams, params)
		self.parentId = parentId
		self.indexId = indexId
		self.value = self.constrain(self.params['default'])
		if self.params['sendMessageOnChange']:
			app.messenger.setQueuing("output%s_%s" %(self.parentId, self.indexId), False)
Esempio n. 2
0
 def __init__(self, params, parentId=0, indexId=0):
     self.params = utils.extendSettings(self.defaultParams, params)
     self.parentId = parentId
     self.indexId = indexId
     self.value = self.constrain(self.params['default'])
     if self.params['sendMessageOnChange']:
         app.messenger.setQueuing(
             "output%s_%s" % (self.parentId, self.indexId), False)
	def createNewInput(self, params):
		newInputInstanceId = self.nextInputInstanceId
		self.nextInputInstanceId += 1
		inputTypeKey = ' '.join([params['subType'], params['type']]).strip()
		params = utils.extendSettings(Inputs.inputTypes[inputTypeKey], params)
		if 'unavailable' in Inputs.inputTypes[inputTypeKey].keys():
			return False
		params['inputTypeKey'] = inputTypeKey
		if params['hasOwnClass']:
			inputClassName = utils.makeCamelCase([params['subType'], params['type'], 'input'], True)
		else:
			inputClassName = 'InputBase'
		inputClass = getattr(Inputs, inputClassName)
		self.inputInstances[newInputInstanceId] = inputClass(params, newInputInstanceId)
		return newInputInstanceId
	def __init__(self, configParams, *args):
		configParams = utils.multiExtendSettings({'inParams' : []}, configParams)
		inParamKeys = [key for key in ['min', 'max', 'default', 'description', 'choices'] if key in configParams]
		for i in range(configParams['number']):
			configParam = {}
			for key in inParamKeys:
				if isinstance(configParams[key], list):
					configParam[key] = configParams[key][i % len(configParams[key])]
				else:
					configParam[key] = configParams[key]
			configParam['relevance'] = [i]
			configParams['inParams'].append(utils.extendSettings(inputTypes[configParams['basicInputType']]['inParams'][0], configParam))
		for key in inParamKeys:
			del configParams[key]
		
		InputBase.__init__(self, configParams, *args)
 def createNewInput(self, params):
     newInputInstanceId = self.nextInputInstanceId
     self.nextInputInstanceId += 1
     inputTypeKey = ' '.join([params['subType'], params['type']]).strip()
     params = utils.extendSettings(Inputs.inputTypes[inputTypeKey], params)
     if 'unavailable' in Inputs.inputTypes[inputTypeKey].keys():
         return False
     params['inputTypeKey'] = inputTypeKey
     if params['hasOwnClass']:
         inputClassName = utils.makeCamelCase(
             [params['subType'], params['type'], 'input'], True)
     else:
         inputClassName = 'InputBase'
     inputClass = getattr(Inputs, inputClassName)
     self.inputInstances[newInputInstanceId] = inputClass(
         params, newInputInstanceId)
     return newInputInstanceId
Esempio n. 6
0
    def __init__(self, configParams, *args):
        configParams = utils.multiExtendSettings({'inParams': []},
                                                 configParams)
        inParamKeys = [
            key for key in ['min', 'max', 'default', 'description', 'choices']
            if key in configParams
        ]
        for i in range(configParams['number']):
            configParam = {}
            for key in inParamKeys:
                if isinstance(configParams[key], list):
                    configParam[key] = configParams[key][i % len(
                        configParams[key])]
                else:
                    configParam[key] = configParams[key]
            configParam['relevance'] = [i]
            configParams['inParams'].append(
                utils.extendSettings(
                    inputTypes[configParams['basicInputType']]['inParams'][0],
                    configParam))
        for key in inParamKeys:
            del configParams[key]

        InputBase.__init__(self, configParams, *args)