Fix choiceButton with some string inputs

Corrects an oversight which created a choiceButton input in addition to a string input field when using string input options "strValSize", "strVal", or "strSize".
This commit is contained in:
KaboPC 2012-10-05 20:13:50 -03:00
parent feefa19118
commit ea1637e1a9

View File

@ -102,7 +102,8 @@ class FilterModuleOptions(Widget):
rows.append(addNumField(page, optionName, val, min, max)) rows.append(addNumField(page, optionName, val, min, max))
if isinstance(optionType[0], (str)): if isinstance(optionType[0], (str, unicode)):
isChoiceButton = False
if len(optionType) == 3: if len(optionType) == 3:
a,b,c = optionType a,b,c = optionType
if a == "strValSize": if a == "strValSize":
@ -111,6 +112,8 @@ class FilterModuleOptions(Widget):
row = Row((Label(optionName), field)) row = Row((Label(optionName), field))
rows.append(row) rows.append(row)
else:
isChoiceButton = True
elif len(optionType) == 2: elif len(optionType) == 2:
a,b = optionType a,b = optionType
if a == "strVal": if a == "strVal":
@ -125,13 +128,16 @@ class FilterModuleOptions(Widget):
row = Row((Label(optionName), field)) row = Row((Label(optionName), field))
rows.append(row) rows.append(row)
else:
isChoiceButton = True
else:
isChoiceButton = True
if isChoiceButton:
choiceButton = ChoiceButton(map(str, optionType))
page.optionDict[optionName] = AttrRef(choiceButton, 'selectedChoice')
if isinstance(optionType[0], (str, unicode)): rows.append(Row((Label(optionName), choiceButton)))
choiceButton = ChoiceButton(map(str, optionType))
page.optionDict[optionName] = AttrRef(choiceButton, 'selectedChoice')
rows.append(Row((Label(optionName), choiceButton)))
elif isinstance(optionType, bool): elif isinstance(optionType, bool):
cbox = CheckBox(value=optionType) cbox = CheckBox(value=optionType)