[pitivi] ui.trackobject, ui.timeline.py, ui.timelinecanvas: add any existing track objects (except default) w



commit eb566210df78127733de9654eec01671e7e10da4
Author: Brandon Lewis <brandon_lewis berkeley edu>
Date:   Fri Apr 17 13:39:15 2009 -0700

    ui.trackobject, ui.timeline.py, ui.timelinecanvas: add any existing track objects (except default) when track is set
---
 pitivi/formatters/etree.py |   13 +++++++++++--
 pitivi/ui/mainwindow.py    |    9 ++++-----
 pitivi/ui/track.py         |   11 +++++++++--
 3 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/pitivi/formatters/etree.py b/pitivi/formatters/etree.py
index d29e39e..f9c8827 100644
--- a/pitivi/formatters/etree.py
+++ b/pitivi/formatters/etree.py
@@ -391,13 +391,17 @@ class ElementTreeFormatter(Formatter):
         timeline_objects = \
                 self._loadTimelineObjects(timeline_objects_element)
 
-        # add the tracks
+        # NOTE: the tracks here are already populated with track objects.
+        # the UI does not get any track-object-added signals
         timeline = Timeline()
         for track in tracks:
             timeline.addTrack(track)
 
         # add the timeline objects
         for timeline_object in timeline_objects:
+            # NOTE: this is a low-level routine that simply appends the
+            # timeline object to the timeline list. It doesn't ensure all the
+            # child track objects have been added to their respective tracks.
             timeline.addTimelineObject(timeline_object)
 
         return timeline
@@ -432,7 +436,9 @@ class ElementTreeFormatter(Formatter):
         project = Project()
         project.timeline = timeline
 
-        # FIXME: add factories to the sources list
+        # FIXME: the default- and max- duration properties of factories are
+        # *not* restored here, so adding objects to the timeline after loading
+        # a files produces objects of 0 duration
 
         for factory in factories:
             if isinstance(factory, SourceFactory):
@@ -440,6 +446,9 @@ class ElementTreeFormatter(Formatter):
             else:
                 raise NotImplementedError()
 
+        # TODO: restore project settings
+        # TODO: restore scroll, playhead, and zoom ratio
+
         return project
 
     ## Formatter method implementations
diff --git a/pitivi/ui/mainwindow.py b/pitivi/ui/mainwindow.py
index 9889626..165ff7b 100644
--- a/pitivi/ui/mainwindow.py
+++ b/pitivi/ui/mainwindow.py
@@ -163,7 +163,6 @@ class PitiviMainWindow(gtk.Window, Loggable):
             self.webcam_button.set_sensitive(False)
 
         # connect to timeline
-        self.app.current.pipeline.activatePositionListener()
         self.show_all()
 
     def showEncodingDialog(self, project, pause=True):
@@ -543,10 +542,10 @@ class PitiviMainWindow(gtk.Window, Loggable):
         return True
 
     def _saveProjectCb(self, unused_action):
-        if not self.app.current.uri:
+        if not self.project.uri:
             self._saveProjectAsCb(unused_action)
         else:
-            self.app.current.save()
+            self.project.save(overwrite=True)
 
     def _saveProjectAsCb(self, unused_action):
         uri = self._showSaveAsDialog(self.app.current)
@@ -670,13 +669,13 @@ class PitiviMainWindow(gtk.Window, Loggable):
     @handler(app, "new-project-loaded")
     def _newProjectLoadedCb(self, unused_pitivi, project):
         self.log("A NEW project is loaded, update the UI!")
-        self.project = project
         # ungrey UI
         self.set_sensitive(True)
 
     @handler(app, "new-project-loading")
-    def _newProjectLoadingCb(self, unused_pitivi, unused_project):
+    def _newProjectLoadingCb(self, unused_instance, project):
         self.log("A NEW project is being loaded, deactivate UI")
+        self.project = project
         # grey UI
         self.set_sensitive(False)
 
diff --git a/pitivi/ui/track.py b/pitivi/ui/track.py
index 716b7f5..d662ae2 100644
--- a/pitivi/ui/track.py
+++ b/pitivi/ui/track.py
@@ -11,8 +11,8 @@ class Track(goocanvas.Group, Zoomable):
         goocanvas.Group.__init__(self)
         Zoomable.__init__(self)
         self.widgets = {}
-        self.track = track
         self.timeline = timeline
+        self.track = track
         self.max_priority = 0
         self._expanded = True
 
@@ -38,7 +38,14 @@ class Track(goocanvas.Group, Zoomable):
 
 ## track signals
 
-    track = receiver()
+    def _setTrack(self):
+        if self.track:
+            for trackobj in self.track.track_objects:
+                if trackobj is self.track.default_track_object:
+                    continue
+                self._objectAdded(None, trackobj)
+
+    track = receiver(_setTrack)
 
     @handler(track, "track-object-added")
     def _objectAdded(self, unused_timeline, track_object):



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