[pitivi/ges: 154/287] mainwindow: Rework a bit the seeking method



commit 4ce117c5c987e30eaa017ba7bfa5a09ddb8106c8
Author: Thibault Saunier <thibault saunier collabora com>
Date:   Mon Jan 9 11:28:17 2012 -0300

    mainwindow: Rework a bit the seeking method

 pitivi/ui/mainwindow.py |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)
---
diff --git a/pitivi/ui/mainwindow.py b/pitivi/ui/mainwindow.py
index 4945a71..a56ac8f 100644
--- a/pitivi/ui/mainwindow.py
+++ b/pitivi/ui/mainwindow.py
@@ -1164,16 +1164,14 @@ class PitiviMainWindow(gtk.Window, Loggable):
 
     def _timelineSeekCb(self, ruler, position, format):
         try:
-            if position < 0:
-                position = 0
-            elif position >= self.timeline.getDuration():
-                position = self.timeline.getDuration()
+            # CLAMP (0, position, self.timeline.getDuration())
+            position = sorted((0, position, self.timeline.getDuration()))[1]
 
             if not self.project_pipeline.seek(1.0, format, gst.SEEK_FLAG_FLUSH,
                     gst.SEEK_TYPE_SET, position, gst.SEEK_TYPE_NONE, -1):
                 self.warning("Could not seek to %s", gst.TIME_ARGS(position))
-
-            self._seeker.setPosition(position)
+            else:
+                self._seeker.setPosition(position)
 
         except Exception, e:
             self.error("seek failed %s %s %s", gst.TIME_ARGS(position), format, e)



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