[pitivi] timeline/track.py: add notion of validitity to track



commit c69b8b23a7f764b51a2165a81029d043118bc9d5
Author: Brandon Lewis <brandon_lewis alum berkeley edu>
Date:   Sat Mar 6 01:42:43 2010 -0800

    timeline/track.py: add notion of validitity to track
    
    the valid_arangement property is False when there exist invalid overlaps in
    the track

 pitivi/timeline/track.py |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/pitivi/timeline/track.py b/pitivi/timeline/track.py
index b23a70a..5121bb9 100644
--- a/pitivi/timeline/track.py
+++ b/pitivi/timeline/track.py
@@ -1061,6 +1061,8 @@ class Track(Signallable, Loggable):
         safe = 0
         duration = 0
         slots = []
+        valid = True
+
         def pop():
             if len(slots):
                 slots.pop(-1)
@@ -1077,24 +1079,32 @@ class Track(Signallable, Loggable):
                 prev = obj
             elif end >= duration and obj.start < safe:
                 pop()
+                valid = False
                 safe = duration
                 duration = end
                 prev = obj
             elif end < duration and obj.start >= safe:
                 safe = end
+                valid = False
             elif end < duration and obj.start < safe:
                 pop()
+                valid = False
                 safe = end
-        return slots
+        return slots, valid
+
+    valid_arrangement = True
 
     def updateTransitions(self):
         # create all new transitions
         valid_slots = set()
+        all_valid = True
         if type(self.stream) is VideoStream:
             for layer in self.getTrackObjectsGroupedByLayer():
                 pos = 0
                 prev = None
-                for slot in self.getValidTransitionSlots(layer):
+                slots, is_valid = self.getValidTransitionSlots(layer)
+                all_valid &= is_valid
+                for slot in slots:
                     a, b = slot
                     if a == prev:
                         b.updatePosition(pos)
@@ -1111,3 +1121,4 @@ class Track(Signallable, Loggable):
         current_slots = set(self.transitions.iterkeys())
         for slot in current_slots - valid_slots:
             self.removeTransition(self.transitions[slot])
+        self.valid_arrangement = all_valid



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