-
Notifications
You must be signed in to change notification settings - Fork 100
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
Handle case when no frame selection for trail overlay #1832
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -1,17 +1,16 @@ | ||||||||||||||
"""Track trail and track list overlays.""" | ||||||||||||||
|
||||||||||||||
from typing import Dict, Iterable, List, Optional, Tuple | ||||||||||||||
|
||||||||||||||
import attr | ||||||||||||||
from qtpy import QtCore, QtGui | ||||||||||||||
|
||||||||||||||
from sleap.gui.overlays.base import BaseOverlay | ||||||||||||||
from sleap.gui.widgets.video import QtTextWithBackground | ||||||||||||||
from sleap.instance import Track | ||||||||||||||
from sleap.io.dataset import Labels | ||||||||||||||
from sleap.io.video import Video | ||||||||||||||
from sleap.prefs import prefs | ||||||||||||||
from sleap.gui.widgets.video import QtTextWithBackground | ||||||||||||||
|
||||||||||||||
import attr | ||||||||||||||
|
||||||||||||||
from typing import Iterable, List, Optional, Dict | ||||||||||||||
|
||||||||||||||
from qtpy import QtCore, QtGui | ||||||||||||||
|
||||||||||||||
|
||||||||||||||
@attr.s(auto_attribs=True) | ||||||||||||||
|
@@ -56,7 +55,9 @@ def get_shade_options(cls): | |||||||||||||
|
||||||||||||||
return {"Dark": 0.6, "Normal": 1.0, "Light": 1.25} | ||||||||||||||
|
||||||||||||||
def get_track_trails(self, frame_selection: Iterable["LabeledFrame"]): | ||||||||||||||
def get_track_trails( | ||||||||||||||
self, frame_selection: Iterable["LabeledFrame"] | ||||||||||||||
) -> Optional[Dict[Track, List[List[Tuple[float, float]]]]]: | ||||||||||||||
Comment on lines
+61
to
+62
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add missing import for The + from sleap.io.dataset import LabeledFrame Committable suggestion
Suggested change
ToolsRuff
|
||||||||||||||
"""Get data needed to draw track trail. | ||||||||||||||
|
||||||||||||||
Args: | ||||||||||||||
|
@@ -152,6 +153,8 @@ def add_to_scene(self, video: Video, frame_idx: int): | |||||||||||||
frame_selection = self.get_frame_selection(video, frame_idx) | ||||||||||||||
|
||||||||||||||
all_track_trails = self.get_track_trails(frame_selection) | ||||||||||||||
if all_track_trails is None: | ||||||||||||||
return | ||||||||||||||
|
||||||||||||||
for track, trails in all_track_trails.items(): | ||||||||||||||
trail_color = tuple( | ||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove unused import.
The
Labels
class fromsleap.io.dataset
is imported but not used in this file.- from sleap.io.dataset import Labels
Committable suggestion
Tools
Ruff