Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set selected instance to None when switching videos/frames #1988

Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion sleap/gui/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ def exportFullPackage(self):
def previousLabeledFrame(self):
"""Goes to labeled frame prior to current frame."""
self.execute(GoPreviousLabeledFrame)

def nextLabeledFrame(self):
"""Goes to labeled frame after current frame."""
self.execute(GoNextLabeledFrame)
Expand Down Expand Up @@ -1597,6 +1597,10 @@ def _get_frame_iterator(context: CommandContext):
reverse=True,
)

def do_action(cls, context: CommandContext, params: dict):
super().do_action(context)
context.state["instance"] = None


class GoNextLabeledFrame(GoIteratorCommand):
@staticmethod
Expand All @@ -1605,6 +1609,9 @@ def _get_frame_iterator(context: CommandContext):
context.state["video"], from_frame_idx=context.state["frame_idx"]
)

def do_action(cls, context: CommandContext, params: dict):
super().do_action(context)
context.state["instance"] = None

class GoNextUserLabeledFrame(GoIteratorCommand):
@staticmethod
Expand Down Expand Up @@ -1690,6 +1697,7 @@ class GoFrameGui(NavCommand):
@classmethod
def do_action(cls, context: "CommandContext", params: dict):
cls.go_to(context, params["frame_idx"])
context.state["instance"] = None

@classmethod
def ask(cls, context: "CommandContext", params: dict) -> bool:
Expand Down Expand Up @@ -1746,6 +1754,7 @@ def do_action(cls, context: CommandContext, params: dict):

context.state["video"] = new_video
context.state["frame_idx"] = frame_idx
context.state["instance"] = None


# Editing Commands
Expand Down
Loading