[pitivi] utils/pipeline: Prevent tracebacks when holding left/right keys on the timeline



commit 23616ff0cb155d8b89fde024b2e4552b14f9bcf4
Author: Jean-François Fortin Tam <nekohayo gmail com>
Date:   Mon Sep 23 14:53:52 2013 -0400

    utils/pipeline: Prevent tracebacks when holding left/right keys on the timeline

 pitivi/utils/pipeline.py |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/pitivi/utils/pipeline.py b/pitivi/utils/pipeline.py
index e84c4a5..459d08e 100644
--- a/pitivi/utils/pipeline.py
+++ b/pitivi/utils/pipeline.py
@@ -537,7 +537,13 @@ class Pipeline(GES.Pipeline, SimplePipeline):
         Seek backwards or forwards a certain amount of frames (frames_offset).
         This clamps the playhead to the project frames.
         """
-        cur_frame = int(round(self.getPosition() * framerate.num / float(Gst.SECOND * framerate.denom), 2))
+        try:
+            position = self.getPosition()
+        except PipelineError:
+            self.warning("Couldn't get position (you're framestepping too quickly), ignoring this request")
+            return
+
+        cur_frame = int(round(position * framerate.num / float(Gst.SECOND * framerate.denom), 2))
         new_frame = cur_frame + frames_offset
         new_pos = long(new_frame * Gst.SECOND * framerate.denom / framerate.num)
         Loggable.info(self, "From frame %d to %d at %f fps, seek to %s s" % (cur_frame,


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