[pitivi] Use Seeker to compress seek events generated with the Left and Right keys.
- From: Edward Hervey <edwardrv src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [pitivi] Use Seeker to compress seek events generated with the Left and Right keys.
- Date: Wed, 19 Aug 2009 09:29:17 +0000 (UTC)
commit 6c0032c5b95e68b07095bffdcbf8332011ae1407
Author: Alessandro Decina <alessandro d gmail com>
Date: Tue Aug 18 12:28:35 2009 +0200
Use Seeker to compress seek events generated with the Left and Right keys.
pitivi/elements/singledecodebin.py | 1 +
pitivi/ui/timeline.py | 24 ++++++++++++++++++------
2 files changed, 19 insertions(+), 6 deletions(-)
---
diff --git a/pitivi/elements/singledecodebin.py b/pitivi/elements/singledecodebin.py
index a86cbcc..6746eb9 100644
--- a/pitivi/elements/singledecodebin.py
+++ b/pitivi/elements/singledecodebin.py
@@ -334,6 +334,7 @@ class SingleDecodeBin(gst.Bin):
self._unblockPad(target=pad)
return True
+ self.debug("stored pending newsegment")
self.pending_newsegment = event
return False
diff --git a/pitivi/ui/timeline.py b/pitivi/ui/timeline.py
index 9647513..295199b 100644
--- a/pitivi/ui/timeline.py
+++ b/pitivi/ui/timeline.py
@@ -39,6 +39,7 @@ from pitivi.receiver import receiver, handler
from zoominterface import Zoomable
from pitivi.ui.common import LAYER_HEIGHT_EXPANDED, LAYER_SPACING
from pitivi.timeline.timeline import MoveContext
+from pitivi.utils import Seeker
# tooltip text for toolbar
DELETE = _("Delete Selected")
@@ -135,6 +136,8 @@ class Timeline(gtk.Table, Loggable, Zoomable):
self._createUI()
self._prev_duration = 0
self.shrink = True
+ self._seeker = Seeker(80)
+ self._seeker.connect('seek', self._seekerSeekCb)
def _createUI(self):
self.leftSizeGroup = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL)
@@ -246,21 +249,30 @@ class Timeline(gtk.Table, Loggable, Zoomable):
if kv == gtk.keysyms.Left:
if mod & gtk.gdk.SHIFT_MASK:
- self.project.pipeline.seekRelative(-gst.SECOND)
+ self._seekRelative(-gst.SECOND)
elif mod & gtk.gdk.CONTROL_MASK:
- self.project.pipeline.seek(ltime+1)
+ self._seeker.seek(ltime+1)
else:
- self.project.pipeline.seekRelative(-long(self.rate * gst.SECOND))
+ self._seekRelative(-long(self.rate * gst.SECOND))
elif kv == gtk.keysyms.Right:
if mod & gtk.gdk.SHIFT_MASK:
- self.project.pipeline.seekRelative(gst.SECOND)
+ self._seekRelative(gst.SECOND)
elif mod & gtk.gdk.CONTROL_MASK:
- self.project.pipeline.seek(rtime+1)
+ self._seeker.seek(rtime+1)
else:
- self.project.pipeline.seekRelative(long(self.rate * gst.SECOND))
+ self._seekRelative(long(self.rate * gst.SECOND))
finally:
return True
+ def _seekRelative(self, time):
+ pipeline = self.project.pipeline
+ seekvalue = max(0, min(pipeline.getPosition() + time,
+ pipeline.getDuration()))
+ self._seeker.seek(seekvalue)
+
+ def _seekerSeekCb(self, seeker, position, format):
+ self.project.pipeline.seek(position, format)
+
def _buttonPress(self, window, event):
self.shrink = False
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]