File tree Expand file tree Collapse file tree 1 file changed +18
-11
lines changed
Expand file tree Collapse file tree 1 file changed +18
-11
lines changed Original file line number Diff line number Diff line change @@ -864,19 +864,26 @@ def display_TOPP_params(params: dict, num_cols):
864864 v .decode () if isinstance (v , bytes ) else v
865865 for v in p ["value" ]
866866 ]
867- valid_entries_info = ''
867+
868+ # Use multiselect when valid_strings are available for better UX
868869 if len (p ['valid_strings' ]) > 0 :
869- valid_entries_info = (
870- " Valid entries are: "
871- + ', ' .join (sorted (p ['valid_strings' ]))
870+ # Filter current values to only include valid options
871+ current_values = [v for v in p ["value" ] if v in p ['valid_strings' ]]
872+ cols [i ].multiselect (
873+ name ,
874+ options = sorted (p ['valid_strings' ]),
875+ default = current_values ,
876+ help = p ["description" ],
877+ key = key ,
878+ )
879+ else :
880+ # Fall back to text_area for freeform list input
881+ cols [i ].text_area (
882+ name ,
883+ value = "\n " .join ([str (val ) for val in p ["value" ]]),
884+ help = p ["description" ] + " Separate entries using the \" Enter\" key." ,
885+ key = key ,
872886 )
873-
874- cols [i ].text_area (
875- name ,
876- value = "\n " .join ([str (val ) for val in p ["value" ]]),
877- help = p ["description" ] + " Separate entries using the \" Enter\" key." + valid_entries_info ,
878- key = key ,
879- )
880887
881888 # increment number of columns, create new cols object if end of line is reached
882889 i += 1
You can’t perform that action at this time.
0 commit comments