[pitivi: 5/7] add last of the menu commands



commit d97ec4b0115907d532f726c606ba990baa88f04a
Author: Brandon Lewis <brandon_lewis berkeley edu>
Date:   Thu Apr 2 01:29:46 2009 -0700

    add last of the menu commands
---
 pitivi/ui/mainwindow.py  |   34 ++++++++++++++++++++++++++++++++--
 pitivi/ui/mainwindow.xml |   15 ++++++++++++++-
 2 files changed, 46 insertions(+), 3 deletions(-)

diff --git a/pitivi/ui/mainwindow.py b/pitivi/ui/mainwindow.py
index 1dc3714..cc124b4 100644
--- a/pitivi/ui/mainwindow.py
+++ b/pitivi/ui/mainwindow.py
@@ -258,13 +258,26 @@ class PitiviMainWindow(gtk.Window, Loggable):
             ("View", None, _("_View")),
             ("Library", None, _("_Project")),
             ("Timeline", None, _("_Timeline")),
+            ("Viewer", None, _("Previe_w")),
             ("Rewind", gtk.STOCK_MEDIA_REWIND, None, None, REWIND,
                 self.rewind),
             ("PlayPause", gtk.STOCK_MEDIA_PLAY, None, "space", PLAY,
                 self.playPause),
             ("FastForward", gtk.STOCK_MEDIA_FORWARD, None, None, FAST_FORWARD,
                 self.fastForward),
-            ("Loop", gtk.STOCK_REFRESH, _("Loop"), None, LOOP,
+            ("FrameForward", gtk.STOCK_MEDIA_FORWARD, _("Frame Forward"),
+                "Right", None, self._seekAction),
+            ("FrameBackward", gtk.STOCK_MEDIA_REWIND, _("Frame Backward"),
+                "Left", None, self._seekAction),
+            ("SecondForward", gtk.STOCK_MEDIA_FORWARD, _("1 Second Forward"),
+                "<Shift>Right", None, self._seekAction),
+            ("SecondBackward", gtk.STOCK_MEDIA_REWIND, _("1 Second Backward"),
+                "<Shift>Left", None, self._seekAction),
+            ("EdgeForward", gtk.STOCK_MEDIA_FORWARD, _("End of Clip"),
+                "<Control>Right", None, self._seekAction),
+            ("EdgeBackward", gtk.STOCK_MEDIA_REWIND, _("Start of Clip"),
+                "<Control>Left", None, self._seekAction),
+             ("Loop", gtk.STOCK_REFRESH, _("Loop"), None, LOOP,
                 self.loop),
             ("Help", None, _("_Help")),
         ]
@@ -308,7 +321,9 @@ class PitiviMainWindow(gtk.Window, Loggable):
                 "ImportSourcesFolder", "PluginManager", "PlayPause",
                 "Project", "FrameForward", "FrameBackward",
                 "ShowHideMainToolbar", "ShowHideTimelineToolbar", "Library",
-                "Timeline"]:
+                "Timeline", "Viewer", "FrameForward", "FrameBackward",
+                "SecondForward", "SecondBackward", "EdgeForward",
+                "EdgeBackward"]:
                 action.set_sensitive(True)
             elif action_name in ["SaveProject", "SaveProjectAs",
                     "NewProject", "OpenProject"]:
@@ -503,6 +518,9 @@ class PitiviMainWindow(gtk.Window, Loggable):
     def _keyPressEventCb(self, unused_widget, event):
         kv = event.keyval
         mod = event.get_state()
+        self._keyPress(kv, mod)
+
+    def _keyPress(self, kv, mod):
         frame = long(self.rate * gst.SECOND)
         now = self.timelinepos
 
@@ -606,6 +624,18 @@ class PitiviMainWindow(gtk.Window, Loggable):
         self.uimanager.get_widget("/TimelineToolBar").props.visible = \
             action.props.active
 
+    def _seekAction(self, action):
+        values = {
+            "FrameForward" : (gtk.keysyms.Right, 0),
+            "FrameBackward" : (gtk.keysyms.Left, 0),
+            "SecondForward" : (gtk.keysyms.Right, gtk.gdk.SHIFT_MASK),
+            "SecondBackward" : (gtk.keysyms.Left, gtk.gdk.SHIFT_MASK),
+            "EdgeForward" : (gtk.keysyms.Right, gtk.gdk.CONTROL_MASK),
+            "EdgeBackward" : (gtk.keysyms.Left, gtk.gdk.CONTROL_MASK),
+        }
+
+        self._keyPress(*values[action.get_name()])
+
     def _aboutResponseCb(self, dialog, unused_response):
         dialog.destroy()
 
diff --git a/pitivi/ui/mainwindow.xml b/pitivi/ui/mainwindow.xml
index b467820..040e00d 100644
--- a/pitivi/ui/mainwindow.xml
+++ b/pitivi/ui/mainwindow.xml
@@ -32,7 +32,20 @@
       <menuitem action="ProjectSettings" />
     </menu>
     <menu action="Timeline">
-        <placeholder name="Timeline" />
+      <placeholder name="Timeline" />
+    </menu>
+    <menu action="Viewer">
+      <menuitem action="PlayPause" />
+      <menuitem action="Loop" />
+      <separator />
+      <menuitem action="FrameForward" />
+      <menuitem action="FrameBackward" />
+      <separator />
+      <menuitem action="SecondForward" />
+      <menuitem action="SecondBackward" />
+      <separator />
+      <menuitem action="EdgeForward" />
+      <menuitem action="EdgeBackward" />
     </menu>
     <menu action="Help">
       <menuitem action="About" />



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