[pitivi: 13/28] etree.py, track.py, ui.track.py: remove references to default TrackObjects



commit 80a235a52461378d82150254299e0f106f598082
Author: Brandon Lewis <brandon_lewis alum berkeley edu>
Date:   Thu Dec 3 19:07:26 2009 -0800

    etree.py, track.py, ui.track.py: remove references to default TrackObjects

 pitivi/formatters/etree.py |    2 --
 pitivi/timeline/track.py   |   33 +++++----------------------------
 pitivi/ui/track.py         |    2 --
 3 files changed, 5 insertions(+), 32 deletions(-)
---
diff --git a/pitivi/formatters/etree.py b/pitivi/formatters/etree.py
index ee01f04..34de3ec 100644
--- a/pitivi/formatters/etree.py
+++ b/pitivi/formatters/etree.py
@@ -462,8 +462,6 @@ class ElementTreeFormatter(Formatter):
         track_objects = SubElement(element, "track-objects")
 
         for track_object in track.track_objects:
-            if track_object is track.default_track_object:
-                continue
 
             track_object_element = self._saveTrackObject(track_object)
             track_objects.append(track_object_element)
diff --git a/pitivi/timeline/track.py b/pitivi/timeline/track.py
index 6f4218f..d4d96d0 100644
--- a/pitivi/timeline/track.py
+++ b/pitivi/timeline/track.py
@@ -661,13 +661,8 @@ class Track(Signallable):
         self.composition.connect('notify::start', self._compositionStartChangedCb)
         self.composition.connect('notify::duration', self._compositionDurationChangedCb)
         self.track_objects = []
-        self.default_track_object = None
         self._max_priority = 0
 
-        default_track_object = self._getDefaultTrackObjectForStream(stream)
-        if default_track_object:
-            self.setDefaultTrackObject(default_track_object)
-
         self.mixer = self._getMixerForStream(stream)
         if self.mixer:
             self.composition.add(self.mixer)
@@ -683,6 +678,7 @@ class Track(Signallable):
     def _getDefaultVideoTrackObject(self, stream):
         factory = VideoTestSourceFactory(pattern='black')
         track_object = SourceTrackObject(factory, stream)
+        track_object.props.priority = 2 ** 32 - 1
 
         return track_object
 
@@ -717,33 +713,15 @@ class Track(Signallable):
     def _getStart(self):
         return self.composition.props.start
 
-    def setDefaultTrackObject(self, track_object):
-        if self.default_track_object is not None:
-            self.removeTrackObject(self.default_track_object)
-
-        self.default_track_object = None
-        track_object.gnl_object.props.priority = 2**32-1
-        self.default_track_object = track_object
-        try:
-            self.addTrackObject(track_object)
-        except:
-            self.default_track_object = None
-            raise
-
-    def _skipDefaultTrackObject(self, timeline_object):
-        return timeline_object is self.default_track_object
-
     def getPreviousTrackObject(self, obj, priority=-1):
-        prev = getPreviousObject(obj, self.track_objects, priority,
-                self._skipDefaultTrackObject)
+        prev = getPreviousObject(obj, self.track_objects, priority)
         if prev is None:
             raise TrackError("no previous track object", obj)
 
         return prev
 
     def getNextTrackObject(self, obj, priority=-1):
-        next = getNextObject(obj, self.track_objects, priority,
-                self._skipDefaultTrackObject)
+        next = getNextObject(obj, self.track_objects, priority)
         if next is None:
             raise TrackError("no next track object", obj)
 
@@ -769,8 +747,7 @@ class Track(Signallable):
 
     def _trackObjectPriorityCb(self, trackobject, priority):
         op = self._max_priority
-        self._max_priority = max((obj.priority for obj in self.track_objects
-            if obj is not self.default_track_object))
+        self._max_priority = max((obj.priority for obj in self.track_objects))
         if op != self._max_priority:
             self.emit("max-priority-changed", self._max_priority)
 
@@ -831,7 +808,7 @@ class Track(Signallable):
 
     def _updateMaxPriority(self):
         priorities = [track_object.priority for track_object in
-            self.track_objects if track_object is not self.default_track_object]
+            self.track_objects]
         if not priorities:
             max_priority = 0
         else:
diff --git a/pitivi/ui/track.py b/pitivi/ui/track.py
index ced7140..bf128a6 100644
--- a/pitivi/ui/track.py
+++ b/pitivi/ui/track.py
@@ -42,8 +42,6 @@ class Track(goocanvas.Group, Zoomable):
     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)



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