From 38871a35fe53b2ae7e734bea32fd500842b705dc Mon Sep 17 00:00:00 2001 From: 7174Andy Date: Thu, 19 Dec 2024 15:44:02 -0800 Subject: [PATCH] update backend init --- sleap/gui/widgets/video.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sleap/gui/widgets/video.py b/sleap/gui/widgets/video.py index 97d1798d6..bbf16db4c 100644 --- a/sleap/gui/widgets/video.py +++ b/sleap/gui/widgets/video.py @@ -2143,8 +2143,11 @@ def _duplicate_instance(self, event): # Add instance to the context context = self.player.context - current_frame = self.instance.frame + current_frame = self.player.state["labeled_frame"] if context: + context.labels.labeled_frames.insert( + self.player.state["frame_idx"], new_instance + ) context.labels.add_instance(current_frame, new_instance) # Create a new QtInstance object for the new instance @@ -2156,6 +2159,7 @@ def _duplicate_instance(self, event): show_non_visible=self.show_non_visible, ) scene.addItem(new_instance_gui) + self.player.update_plot() # Select the duplicated QtInstance object new_instance_gui.setFlag(QGraphicsItem.ItemIsMovable)