@@ -1614,7 +1614,7 @@ def _session_context_menu(self, session_name: str) -> bool:
16141614 self .job_scheduler .cancel_job (actions_running [s .name ][process .Action .IMPORT ][r ])
16151615 callbacks .remove_folder (s .working_directory )
16161616 changed = True
1617- changed |= self ._draw_context_menu_items_for_recording_folders (sess , None )
1617+ changed |= self ._draw_context_menu_items_for_recording_folders (sess , None , actions_running )
16181618 return changed
16191619 def _recording_context_menu (self , session_name : str , rec_name : str ) -> bool :
16201620 # ignore input recording name, get selected sessions
@@ -1676,9 +1676,9 @@ def _recording_context_menu(self, session_name: str, rec_name: str) -> bool:
16761676 if imgui .selectable (ifa6 .ICON_FA_DOWNLOAD + ' Set calibration XML' , False )[0 ]:
16771677 gt_gui .utils .push_popup (self , callbacks .get_folder_picker (self , reason = 'set_cam_cal' , working_directory = working_directory ))
16781678 imgui .end_menu ()
1679- changed = self ._draw_context_menu_items_for_recording_folders ([sess ], recs )
1679+ changed = self ._draw_context_menu_items_for_recording_folders ([sess ], recs , actions_running )
16801680 return changed
1681- def _draw_context_menu_items_for_recording_folders (self , sess : list [session .Session ], recs : list [str ]| None ):
1681+ def _draw_context_menu_items_for_recording_folders (self , sess : list [session .Session ], recs : list [str ]| None , actions_running : dict [ str , dict [ process . Action , bool | list [ str ]]] ):
16821682 if recs is None :
16831683 recs = [(i ,r ) for i ,s in enumerate (sess ) for r in s .recordings ]
16841684 else :
@@ -1699,6 +1699,9 @@ def _draw_context_menu_items_for_recording_folders(self, sess: list[session.Sess
16991699 callbacks .open_folder (self , sess [s ].recordings [r ].info .working_directory )
17001700 if working_directories and imgui .selectable (ifa6 .ICON_FA_TRASH_CAN + " Delete recording" + plural , False )[0 ]:
17011701 for s ,r in recs :
1702+ # if an import action is currently running, cancel that first
1703+ if sess [s ].name in actions_running and process .Action .IMPORT in actions_running [sess [s ].name ] and r in actions_running [sess [s ].name ][process .Action .IMPORT ]:
1704+ self .job_scheduler .cancel_job (actions_running [s .name ][process .Action .IMPORT ][r ])
17021705 callbacks .remove_folder (sess [s ].recordings [r ].info .working_directory )
17031706 changed = True
17041707 return changed
0 commit comments