@@ -86,6 +86,29 @@ def __init__(self):
8686 # When an ExperimentDialog is closed, update the experiment info
8787 self .experiment_closed .connect (self .load_and_refresh_experiment_info )
8888
89+ # Create the experiment list context menu
90+ self ._context_menu = QMenu (self )
91+
92+ action_open = QAction ("Open" , self )
93+ action_open .triggered .connect (self .on_open_button_clicked )
94+ self ._context_menu .addAction (action_open )
95+
96+ action_remove = QAction ("Remove" , self )
97+ action_remove .triggered .connect (self .on_remove_button_clicked )
98+ self ._context_menu .addAction (action_remove )
99+
100+ action_clone = QAction ("Clone" , self )
101+ action_clone .triggered .connect (self .on_clone_button_clicked )
102+ self ._context_menu .addAction (action_clone )
103+
104+ action_export = QAction ("Export" , self )
105+ action_export .triggered .connect (self .on_export_button_clicked )
106+ self ._context_menu .addAction (action_export )
107+
108+ action_rename = QAction ("Rename" , self )
109+ action_rename .triggered .connect (self .on_rename_button_clicked )
110+ self ._context_menu .addAction (action_rename )
111+
89112 def on_edit_workspace_clicked (self ):
90113 logger .debug ('[MLC_MANAGER] [EDIT_WORKSPACE] - On_edit_workspace_location triggered' )
91114 new_workspace_dir = QFileDialog .getExistingDirectory (self , 'Choose the new workspace directory' ,
@@ -386,29 +409,11 @@ def on_rename_button_clicked(self):
386409 def on_experiment_list_context_menu (self , point ):
387410 logger .debug ('[MLC_MANAGER] [LIST_CONTEXT_MENU] - Context Menu displayed' )
388411
389- menu = QMenu (self )
390-
391- action_open = QAction ("Open" , self )
392- action_open .triggered .connect (self .on_open_button_clicked )
393- menu .addAction (action_open )
394-
395- action_remove = QAction ("Remove" , self )
396- action_remove .triggered .connect (self .on_remove_button_clicked )
397- menu .addAction (action_remove )
398-
399- action_clone = QAction ("Clone" , self )
400- action_clone .triggered .connect (self .on_clone_button_clicked )
401- menu .addAction (action_clone )
402-
403- action_export = QAction ("Export" , self )
404- action_export .triggered .connect (self .on_export_button_clicked )
405- menu .addAction (action_export )
406-
407- action_rename = QAction ("Rename" , self )
408- action_rename .triggered .connect (self .on_rename_button_clicked )
409- menu .addAction (action_rename )
412+ if self ._experiment_selected is None :
413+ logger .info ("[MLC MANAGER] [RENAME_BUTTON] - No experiment was selected yet. Don't do anything" )
414+ return
410415
411- menu .popup (self ._autogenerated_object .experiment_list .mapToGlobal (point ))
416+ self . _context_menu .popup (self ._autogenerated_object .experiment_list .mapToGlobal (point ))
412417
413418 def on_experiment_list_clicked (self , model_index ):
414419 list_view = self ._autogenerated_object .experiment_list
0 commit comments