Skip to content

Commit

Permalink
Set selected instance to None after removal
Browse files Browse the repository at this point in the history
  • Loading branch information
roomrys committed Jun 13, 2024
1 parent 5c4c5db commit 9b4933a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions sleap/gui/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -2296,6 +2296,8 @@ def _do_deletion(context: CommandContext, lf_inst_list: List[int]):
lfs_to_remove = []
for lf, inst in lf_inst_list:
context.labels.remove_instance(lf, inst, in_transaction=True)
if context.state["instance"] == inst:
context.state["instance"] = None
if len(lf.instances) == 0:
lfs_to_remove.append(lf)

Expand Down Expand Up @@ -2533,6 +2535,7 @@ def do_action(context: CommandContext, params: dict):
return

context.labels.remove_instance(context.state["labeled_frame"], selected_inst)
context.state["instance"] = None


class DeleteSelectedInstanceTrack(EditCommand):
Expand All @@ -2550,6 +2553,7 @@ def do_action(context: CommandContext, params: dict):

track = selected_inst.track
context.labels.remove_instance(context.state["labeled_frame"], selected_inst)
context.state["instance"] = None

if track is not None:
# remove any instance on this track
Expand Down

0 comments on commit 9b4933a

Please sign in to comment.