Codebase list ctdconverter / 36b4309
Add preselection of default value in select lists. Add detection of boolean select choices (OpenMS) to handle flag parameters properly. Clemens BlanK 7 years ago
1 changed file(s) with 11 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
10281028 option_node = add_child_node(param_node, "option", OrderedDict([("value", str(choice))]))
10291029 option_node.text = str(choice)
10301030
1031 # preselect the default value
1032 if param.default == choice:
1033 option_node.attrib["selected"] = "true"
1034
10311035 elif type(param.restrictions) is _NumericRange:
10321036 if param.type is not int and param.type is not float:
10331037 raise InvalidModelException("Expected either 'int' or 'float' in the numeric range restriction for "
11881192
11891193 # determines if the given choices are boolean (basically, if the possible values are yes/no, true/false)
11901194 def is_boolean_parameter(param):
1191 return param.type is bool
1195 ## detect boolean selects of OpenMS
1196 if is_selection_parameter(param):
1197 if len(param.restrictions.choices) == 2:
1198 if "false" in param.restrictions.choices and "true" in param.restrictions.choices:
1199 return True
1200 else:
1201 return param.type is bool
11921202
11931203
11941204 # determines if there are choices for the parameter