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



commit 67917394bedea1f98d6b8224b85c183576116729
Author: Alessandro Decina <alessandro d gmail com>
Date:   Sat Jul 4 03:34:07 2009 +0200

    Revert "timeline.py: fix TimelineObject.split() which was broken by commit"
    
    This reverts commit 0599fd6ea6db60f0277047787bd1512d6946b7da.

 pitivi/timeline/timeline.py |   19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)
---
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index d1145ba..e90ea8f 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -344,17 +344,26 @@ class TimelineObject(Signallable, Loggable):
         if not self.track_objects:
             raise TimelineError()
 
-        if position <= self.start or position >= self.start + self.duration:
-            raise TimelineError("can't split at position %s")
-
         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 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.setDuration(position - self.start, set_media_stop=True)
-        other.trimStart(position)
+        self.emit('duration-changed', self.duration)
 
         return other
 



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