From ea1637e1a968cdffb94e1c607ce069d780bde493 Mon Sep 17 00:00:00 2001 From: KaboPC Date: Fri, 5 Oct 2012 20:13:50 -0300 Subject: [PATCH] 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". --- editortools/filter.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/editortools/filter.py b/editortools/filter.py index d433caf..8add118 100644 --- a/editortools/filter.py +++ b/editortools/filter.py @@ -102,7 +102,8 @@ class FilterModuleOptions(Widget): 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: a,b,c = optionType if a == "strValSize": @@ -110,7 +111,9 @@ class FilterModuleOptions(Widget): page.optionDict[optionName] = AttrRef(field, 'value') row = Row((Label(optionName), field)) - rows.append(row) + rows.append(row) + else: + isChoiceButton = True elif len(optionType) == 2: a,b = optionType if a == "strVal": @@ -125,13 +128,16 @@ class FilterModuleOptions(Widget): row = Row((Label(optionName), field)) rows.append(row) + else: + isChoiceButton = True + else: + isChoiceButton = True - - if isinstance(optionType[0], (str, unicode)): - choiceButton = ChoiceButton(map(str, optionType)) - page.optionDict[optionName] = AttrRef(choiceButton, 'selectedChoice') + if isChoiceButton: + choiceButton = ChoiceButton(map(str, optionType)) + page.optionDict[optionName] = AttrRef(choiceButton, 'selectedChoice') - rows.append(Row((Label(optionName), choiceButton))) + rows.append(Row((Label(optionName), choiceButton))) elif isinstance(optionType, bool): cbox = CheckBox(value=optionType)