示例#1
0
文件: BugOptions.py 项目: AP-ML/DTM
	def getIndex(self, *args):
		value = self.getRealValue(*args)
		if self.isStringList():
			return value
		elif self.isColorList():
			return ColorUtil.keyToIndex(value)
		else:
			return self.findClosestIndex(value)
示例#2
0
	def getIndex(self, *args):
		value = self.getRealValue(*args)
		if self.isStringList():
			return value
		elif self.isColorList():
			return ColorUtil.keyToIndex(value)
		else:
			return self.findClosestIndex(value)
示例#3
0
 def ensureValidDropdownIndex(self, optionName, index):
     option = self.getOption(optionName)
     if option is None:
         return index, False
     if index < 0 or index >= len(option.getDisplayValues()):
         index = option.getDefault()
         if "COLOR" in str(index):
             index = ColorUtil.keyToIndex(index)
         if index < 0 or index >= len(option.getDisplayValues()):
             return index, False
         else:  # Store the repaired index in the option object
             option.setIndex(index)
     return index, True