[pitivi] timeline: Reimplement the seeking and framestepping keyboard shortcuts



commit e2c59ca083e059b7a8cb36724212facff0c06596
Author: Jean-François Fortin Tam <nekohayo gmail com>
Date:   Mon Sep 23 13:25:11 2013 -0400

    timeline: Reimplement the seeking and framestepping keyboard shortcuts
    
    This allows using left/right and shift+left/right to seek backwards or forwards
    for one project frame or for one second.
    
    Ctrl+left/right (seek to the nearest clip on the left/right) was not
    reimplemented as this is a buggy and rarely used feature that complexifies code.

 help/C/cheatsheet.page      |    1 -
 pitivi/timeline/timeline.py |   14 ++++++++++++++
 2 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/help/C/cheatsheet.page b/help/C/cheatsheet.page
index c22a607..b5e0b52 100644
--- a/help/C/cheatsheet.page
+++ b/help/C/cheatsheet.page
@@ -51,7 +51,6 @@
           <item><p><key>S</key>: Split the clips at the current playhead position. If there are selected 
clips, only those will be split.</p></item>
           <item><p><key>Delete</key>: Remove selected clips from the timeline.</p></item>
           <item><p><key>←</key> and <key>→</key>: Seek one frame backwards or forwards. This depends on your 
project framerate.</p></item>
-          <item><p><key>Ctrl+←</key> and <key>Ctrl+→</key>: Seek one clip backwards or forwards.</p></item>
           <item><p><key>Shift+←</key> and <key>Shift+→</key>: Seek one second backwards or 
forwards.</p></item>
           <item><p><key>Ctrl++</key> and <key>Ctrl+-</key>: Zoom in or zoom out. You can also use 
<key>Ctrl</key> with the mouse wheel to control the zoom more efficiently.</p></item>
           <item><p><key>Ctrl+0</key>: Adjust the zoom to fit the timeline.</p></item>
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index 724c3f3..0a71166 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -1315,11 +1315,25 @@ class Timeline(Gtk.VBox, Zoomable, Loggable):
     # Callbacks
 
     def _keyPressEventCb(self, widget, event):
+        # This is used both for changing the selection modes and for affecting
+        # the seek keyboard shortcuts further below
         if event.keyval == Gdk.KEY_Shift_L:
             self._shiftMask = True
         elif event.keyval == Gdk.KEY_Control_L:
             self._controlMask = True
 
+        # Now the second (independent) part: framestepping and seeking shortcuts
+        if event.keyval == Gdk.KEY_Left:
+            if self._shiftMask:
+                self._seeker.seekRelative(0 - Gst.SECOND)
+            else:
+                self._project.pipeline.stepFrame(self._framerate, -1)
+        elif event.keyval == Gdk.KEY_Right:
+            if self._shiftMask:
+                self._seeker.seekRelative(Gst.SECOND)
+            else:
+                self._project.pipeline.stepFrame(self._framerate, 1)
+
     def _keyReleaseEventCb(self, widget, event):
         if event.keyval == Gdk.KEY_Shift_L:
             self._shiftMask = False


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]