@@ -268,15 +268,7 @@ def get_boutiques_input(inputs, interface, input_name, spec, verbose,
268
268
elif handler_type == "Float" :
269
269
inp ['type' ] = "Number"
270
270
elif handler_type == "Bool" :
271
- if (spec .argstr and len (spec .argstr .split ("=" )) > 1 and
272
- (spec .argstr .split ("=" )[1 ] == '0'
273
- or spec .argstr .split ("=" )[1 ] == '1' )):
274
- inp ['type' ] = "Number"
275
- inp ['integer' ] = True
276
- inp ['minimum' ] = 0
277
- inp ['maximum' ] = 1
278
- else :
279
- inp ['type' ] = "Flag"
271
+ inp ['type' ] = "Flag"
280
272
else :
281
273
inp ['type' ] = "String"
282
274
@@ -296,14 +288,24 @@ def get_boutiques_input(inputs, interface, input_name, spec, verbose,
296
288
# TODO handle lists of lists (e.g. FSL ProbTrackX seed input)
297
289
if handler_type == "List" :
298
290
inp ['list' ] = True
299
- trait_type = type (trait_handler .item_trait .trait_type ).__name__
300
- if trait_type == "Int" :
291
+ item_type = trait_handler .item_trait .trait_type
292
+ item_type_name = type (item_type ).__name__
293
+ if item_type_name == "Int" :
301
294
inp ['integer' ] = True
302
295
inp ['type' ] = "Number"
303
- elif trait_type == "Float" :
296
+ elif item_type_name == "Float" :
304
297
inp ['type' ] = "Number"
305
- elif trait_type == "File" :
298
+ elif item_type_name == "File" :
306
299
inp ['type' ] = "File"
300
+ elif item_type_name == "Enum" :
301
+ value_choices = item_type .values
302
+ if value_choices is not None :
303
+ if all (isinstance (n , int ) for n in value_choices ):
304
+ inp ['type' ] = "Number"
305
+ inp ['integer' ] = True
306
+ elif all (isinstance (n , float ) for n in value_choices ):
307
+ inp ['type' ] = "Number"
308
+ inp ['value-choices' ] = value_choices
307
309
else :
308
310
inp ['type' ] = "String"
309
311
if trait_handler .minlen != 0 :
@@ -532,7 +534,7 @@ def generate_custom_inputs(desc_inputs):
532
534
for desc_input in desc_inputs :
533
535
if desc_input ['type' ] == 'Flag' :
534
536
custom_input_dicts .append ({desc_input ['id' ]: True })
535
- elif desc_input .get ('value-choices' ):
537
+ elif desc_input .get ('value-choices' ) and not desc_input . get ( 'list' ) :
536
538
for value in desc_input ['value-choices' ]:
537
539
custom_input_dicts .append ({desc_input ['id' ]: value })
538
540
return custom_input_dicts
@@ -578,8 +580,12 @@ def get_command_line_flag(input_spec, is_flag_type=False, input_name=None):
578
580
flag , flag_sep = None , None
579
581
if input_spec .argstr :
580
582
if "=" in input_spec .argstr :
581
- flag = input_spec .argstr .split ("=" )[0 ].strip ()
582
- flag_sep = "="
583
+ if (input_spec .argstr .split ("=" )[1 ] == '0'
584
+ or input_spec .argstr .split ("=" )[1 ] == '1' ):
585
+ flag = input_spec .argstr
586
+ else :
587
+ flag = input_spec .argstr .split ("=" )[0 ].strip ()
588
+ flag_sep = "="
583
589
elif input_spec .argstr .split ("%" )[0 ]:
584
590
flag = input_spec .argstr .split ("%" )[0 ].strip ()
585
591
elif is_flag_type :
0 commit comments