Dear Galaxy user,
I'm working on a interface where the user can choose multiple data files using <param name="data_selection" type="data" multiple="true" />. Although I didn't find details about this in the manual, it does work. The next step in the interface are two select boxes (<param type="select" samples" multiple="true" dynamic_options="copy_selected_data_names(data_selection)" />) which allow further selection on the data chosen in "data_selection".
I created a small python script that copies the entries selected in "data_selection" as follows:
def copy_selected_data_names(DataToolParameter_multiple_object): items =  if(DataToolParameter_multiple_object != NULL): if(type(DataToolParameter_multiple_object) == type()): ## If it is a list for g in DataToolParameter_multiple_object: items.append([g.name,g.file_name,False]) else: ## If it isn't a list items.append([DataToolParameter_multiple_object.name,DataToolParameter_multiple_object.file_name,False]) return items
I noticed that once only one single object is selected, the DataToolParameter returns directly one HistoryDatasetAssociation object. Once several are selected, it returns a list with HistoryDatasetAssociation objects. I think this is not correct; the DataToolParameter is a object where multple is set to "true" so it should always return a list even if none or 1 object is selected.
Nevertheless, this part of the code works. However, the update of the dynamic_options="copy_selected_data_names(data_selection)" only takes place whenever new objects (in repeat blocks) are added or removed elsewhere in the interface. Thus, the copying of the content doesn't take place when the selection has changed.
My question is: is there a way to make dynamic_options="" update whenever the selection in "data_selection" has changed?
I checked the code and I found some variables in the DataToolParameter class that may have something to do with it:
self.refresh_on_change = False self.refresh_on_change_values = 
But I'm not able to solve the puzzle on my own. Is there anyone who can help in this direction? Thanks in advance!