[pitivi: 11/16] timeline.py: fix TimelineObject.split() which was broken by commit



commit 0599fd6ea6db60f0277047787bd1512d6946b7da
Author: Brandon Lewis <brandon_lewis berkeley edu>
Date:   Fri Jul 3 17:44:14 2009 -0700

    timeline.py: fix TimelineObject.split() which was broken by commit
    9122088baac0e760567c3c931c9ed6580c852a85
    
    The problem is that the track objects created by TimelineObjectcopy() were not properly
    removed from the timeline. Now instead of calling trackObject.split() for each
    track object, we simply call setDuration() and trimStart on the timeline
    object copies.

 pitivi/timeline/timeline.py |   19 +++++--------------
 1 files changed, 5 insertions(+), 14 deletions(-)
---
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index e90ea8f..d1145ba 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -344,26 +344,17 @@ class TimelineObject(Signallable, Loggable):
         if not self.track_objects:
             raise TimelineError()
 
-        other = self.copy()
-        # ditch track objects. This is a bit weird, will be more clear when we
-        # use other uses of TimelineObject.copy
-        other.track_objects = []
-
-        for track_object in self.track_objects:
-            try:
-                other_track_object = track_object.splitObject(position)
-            except TrackError, e:
-                # FIXME: hallo exception hierarchy?
-                raise TimelineError(str(e))
-
-            other.addTrackObject(other_track_object)
+        if position <= self.start or position >= self.start + self.duration:
+            raise TimelineError("can't split at position %s")
 
+        other = self.copy()
         if self.timeline is not None:
             # if self is not yet in a timeline, the caller needs to add "other"
             # as well when it adds self
             self.timeline.addTimelineObject(other)
 
-        self.emit('duration-changed', self.duration)
+        self.setDuration(position - self.start, set_media_stop=True)
+        other.trimStart(position)
 
         return other
 



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