Skip to content

Commit

Permalink
Modify JumpToStart to use the GetMinFrame() method, and have it scrol…
Browse files Browse the repository at this point in the history
…l to the new playhead position. This will select the first clip on the timeline and jump the scrollbar to it. Also updated the JumpToEnd to scroll to the playhead position.
  • Loading branch information
jonoomph committed Oct 1, 2024
1 parent 0699779 commit 8a25c68
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/windows/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -1119,13 +1119,18 @@ def actionJumpStart_trigger(self, checked=True):
player = self.preview_thread.player
current_speed = player.Speed()

min_frame = 1
if self.preview_thread and self.preview_thread.timeline:
min_frame = self.preview_thread.timeline.GetMinFrame()

# Switch speed back to forward (and then pause)
# This will allow video caching to start working in the forward direction
self.SpeedSignal.emit(1)
self.SpeedSignal.emit(0)

# Seek to the 1st frame
self.SeekSignal.emit(1)
self.SeekSignal.emit(min_frame)
QTimer.singleShot(50, self.actionCenterOnPlayhead_trigger)

# If playing, continue playing
if current_speed >= 0:
Expand All @@ -1140,6 +1145,7 @@ def actionJumpEnd_trigger(self, checked=True):
# Determine last frame (based on clips) & seek there
max_frame = get_app().window.timeline_sync.timeline.GetMaxFrame()
self.SeekSignal.emit(max_frame)
QTimer.singleShot(50, self.actionCenterOnPlayhead_trigger)

def onPlayCallback(self):
"""Handle when playback is started"""
Expand Down

0 comments on commit 8a25c68

Please sign in to comment.