Skip to content

Commit

Permalink
remove callback_connected
Browse files Browse the repository at this point in the history
  • Loading branch information
7174Andy committed Dec 20, 2024
1 parent e9d2c97 commit b68892a
Showing 1 changed file with 0 additions and 9 deletions.
9 changes: 0 additions & 9 deletions sleap/gui/widgets/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -2156,17 +2156,12 @@ def duplicate_instance(self):
# Refresh the plot
self.player.plot()

# Track if the new instance is connected for clean up
callback_connected = False

def on_selection_update():
"""Callback to set the new QtInstance to be movable."""
# Find the QtInstance corresponding to the newly created instance
for qt_inst in self.player.view.all_instances:
if qt_inst.instance == new_instance:
self.player.view.updatedSelection.disconnect(on_selection_update)
nonlocal callback_connected
callback_connected = True

# Set this QtInstance to be movable
qt_inst.setFlag(QGraphicsItem.ItemIsMovable)
Expand All @@ -2180,10 +2175,6 @@ def on_selection_update():
self.player.view.updatedSelection.connect(on_selection_update)
self.player.view.updatedSelection.emit()

# Clean up callback if QtInstance was not found
if not callback_connected:
self.player.view.updatedSelection.disconnect(on_selection_update)

def mouseMoveEvent(self, event):
"""Custom event handler to emit signal on event."""
is_move = self.flags() & QGraphicsItem.ItemIsMovable
Expand Down

0 comments on commit b68892a

Please sign in to comment.