pitivi r1219 - in branches/SOC_2008_BLEWIS: . pitivi pitivi/ui



Author: blewis
Date: Fri Jul 25 20:00:41 2008
New Revision: 1219
URL: http://svn.gnome.org/viewvc/pitivi?rev=1219&view=rev

Log:
Commit hopefully makes the timeline actually work when a new project is
loaded.
* pitivi/playground.py:
added getTimeline() method
commented line 144 in removePipeline, because it crashed with a type error
when trying to remove the timeline
* pitivi/ui/viewer.py:
made the viewer actually remove the old timeline bin from the playground
when a new project is loaded.


Modified:
   branches/SOC_2008_BLEWIS/ChangeLog
   branches/SOC_2008_BLEWIS/pitivi/playground.py
   branches/SOC_2008_BLEWIS/pitivi/ui/viewer.py

Modified: branches/SOC_2008_BLEWIS/pitivi/playground.py
==============================================================================
--- branches/SOC_2008_BLEWIS/pitivi/playground.py	(original)
+++ branches/SOC_2008_BLEWIS/pitivi/playground.py	Fri Jul 25 20:00:41 2008
@@ -141,7 +141,7 @@
 
         bus = pipeline.get_bus()
         bus.remove_signal_watch()
-        bus.set_sync_handler(None)
+        #bus.set_sync_handler(None)
 
         if pipeline.set_state(gst.STATE_READY) == gst.STATE_CHANGE_FAILURE:
             return False
@@ -206,13 +206,18 @@
         will be taken.
         """
         if isinstance(self.current, SmartTimelineBin):
-            # fast path
             return True
+        p = self.getTimeline()
+        if p:
+            self.switchToPipeline(p)
+            return True
+        return False
+
+    def getTimeline(self):
         for pipeline in self.pipelines:
             if isinstance(pipeline, SmartTimelineBin):
-                self.switchToPipeline(pipeline)
-                return True
-        return False
+                return pipeline
+        return None
 
     def setVideoSinkThread(self, vsinkthread):
         """ sets the video sink thread """

Modified: branches/SOC_2008_BLEWIS/pitivi/ui/viewer.py
==============================================================================
--- branches/SOC_2008_BLEWIS/pitivi/ui/viewer.py	(original)
+++ branches/SOC_2008_BLEWIS/pitivi/ui/viewer.py	Fri Jul 25 20:00:41 2008
@@ -64,7 +64,7 @@
         # signal for timeline duration changes : (composition, sigid)
         self._timelineDurationChangedSigId = (None, None)
 
-        self._addTimelineToPlayground()
+
 
     def _connectToProject(self, project):
         """Connect signal handlers to a project.
@@ -77,6 +77,10 @@
                                      None, self._tmpIsReadyCb)
         self.project_signals.connect(project, "settings-changed",
                                      None, self._settingsChangedCb)
+        # we should add the timeline to the playground here, so
+        # that the new timeline bin will be added to the
+        # playground when the project loads
+        self._addTimelineToPlayground()
 
     def _createUi(self):
         """ Creates the Viewer GUI """
@@ -342,8 +346,14 @@
         self._connectToProject(project)
 
     def _addTimelineToPlayground(self):
-        instance.PiTiVi.playground.addPipeline(instance.PiTiVi.current.getBin())
-
+        # remove old timeline before proceeding
+        pg = instance.PiTiVi.playground
+        timeline = pg.getTimeline()
+        if timeline:
+            pg.switchToDefault()
+            pg.removePipeline(timeline)
+        # add current timeline
+        pg.addPipeline(instance.PiTiVi.current.getBin())
 
     ## Control gtk.Button callbacks
 



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