[pitivi] pipeline: Raise an exception when setting the timeline fails



commit 1a7b80c831b3c7f3b60116e6a968beb530689f36
Author: Alexandru Băluț <alexandru balut gmail com>
Date:   Mon Jan 20 22:21:23 2014 +0100

    pipeline: Raise an exception when setting the timeline fails

 pitivi/project.py        |    8 ++++++--
 pitivi/utils/pipeline.py |    9 ++++-----
 2 files changed, 10 insertions(+), 7 deletions(-)
---
diff --git a/pitivi/project.py b/pitivi/project.py
index 97ce064..55e4e42 100644
--- a/pitivi/project.py
+++ b/pitivi/project.py
@@ -41,7 +41,7 @@ from pitivi.undo.undo import UndoableAction
 from pitivi.configure import get_ui_dir
 
 from pitivi.utils.misc import quote_uri, path_from_uri, isWritable
-from pitivi.utils.pipeline import Seeker
+from pitivi.utils.pipeline import PipelineError, Seeker
 from pitivi.utils.loggable import Loggable
 from pitivi.utils.signal import Signallable
 from pitivi.utils.pipeline import Pipeline
@@ -874,7 +874,11 @@ class Project(Loggable, GES.Project):
         self._calculateNbLoadingAssets()
 
         self.pipeline = Pipeline()
-        self.pipeline.set_timeline(self.timeline)
+        try:
+            self.pipeline.set_timeline(self.timeline)
+        except PipelineError, e:
+            self.warning("Failed to set the timeline to the pipeline: %s", e)
+            return False
 
         return True
 
diff --git a/pitivi/utils/pipeline.py b/pitivi/utils/pipeline.py
index 27d752d..3024b2c 100644
--- a/pitivi/utils/pipeline.py
+++ b/pitivi/utils/pipeline.py
@@ -555,6 +555,7 @@ class Pipeline(GES.Pipeline, SimplePipeline):
         GES.Pipeline.__init__(self)
         SimplePipeline.__init__(self, self)
 
+        self._timeline = None
         self._seeker = Seeker()
         self._seeker.connect("seek", self._seekCb)
         self._seeker.connect("seek-relative", self._seekRelativeCb)
@@ -563,11 +564,9 @@ class Pipeline(GES.Pipeline, SimplePipeline):
         return self._timeline.get_duration()
 
     def set_timeline(self, timeline):
-        if GES.Pipeline.set_timeline(self, timeline):
-            self._timeline = timeline
-            return True
-
-        return False
+        if not GES.Pipeline.set_timeline(self, timeline):
+            raise PipelineError("Cannot set the timeline to the pipeline")
+        self._timeline = timeline
 
     def release(self):
         """


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