Arrow-key navigation crashes when a track header is selected
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
Research direction
Start in the keyPressEvent() handler and _get_first_item(), where the arrow-key navigation picks its starting item and filters the selection. Reproduce by selecting a track header (track_widgets.TrackNameItem) and pressing Left or Right, which should raise the AttributeError on a None item. Done means navigation skips track headers and ignores items whose .item is None, and an empty timeline returns None without error.
Written by the indexing model from the issue text.
Description
Arrow-key navigation crashes when a track header is selected
Steps to reproduce:
- Open a timeline containing clips.
- Click a track header on the left.
- Press Left or Right, without modifiers.
This raises:
AttributeError: 'NoneType' object has no attribute 'parent'
Clearing the selection and pressing Right twice also reproduced the issue: the first press selected a track header, and the second crashed.
TrackNameItem inherits BaseItem, but its .item is None. It passes the navigation type check, leading to otio_item.parent() being called on None.
Proposed fix
- Replace
_get_first_item()with a lookup of valid timeline items, avoiding fixed-coordinate hit testing:
def _get_first_item(self):
return min(
(item for item in self.scene().items() if isinstance(item, track_widgets.BaseItem) and item.item is not None),
key=lambda item: (item.scenePos().y(), item.scenePos().x()),
default=None,
)
- In
keyPressEvent(), exclude track headers as well as the ruler:
selections = [
x for x in self.scene().selectedItems()
if not isinstance(x, (ruler_widget.Ruler, track_widgets.TrackNameItem))
]
With these changes, navigation starts from a valid timeline item when no clip is selected, while empty timelines safely return None.
- Dominant language
- Python
- Stars
- 2
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from OpenTimelineIO/otioview
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
OpenTimelineIO/otioview#7 · 2 comments ·
All issues in OpenTimelineIO/otioview
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
microsoft/markitdown#2820 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
yt-project/yt#5624 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
NousResearch/hermes-agent#148376 ·
Maintainers usually reply within 1 day
-
Analysis
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
SACGF/variantgrid#2615 ·
Maintainers usually reply within 1 day