[pitivi] Fixe error noticed by Alessandro in its review of the timeline code for effect implementation: http:



commit fd37a56fbdbe5474451c2df4a3a217d814b7b9c0
Author: Thibault Saunier <tsaunier gnome org>
Date:   Mon Aug 30 15:19:07 2010 +0200

    Fixe error noticed by Alessandro in its review of the timeline code for effect implementation: http://sourceforge.net/mailarchive/message.php?msg_name=AANLkTi%3DwZkAs4Rsfq1bv6YECyk%2Bf3GLYvN%3Dwc8GYbKaL%40mail.gmail.com

 pitivi/timeline/timeline.py      |   25 +++++++++++--------------
 pitivi/timeline/timeline_undo.py |    2 +-
 pitivi/timeline/track.py         |   15 +++++++++------
 3 files changed, 21 insertions(+), 21 deletions(-)
---
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index 68f5b11..6612fb5 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -1676,8 +1676,8 @@ class Timeline(Signallable, Loggable):
         timeline_object = TimelineObject(factory)
         start = 0
         for stream, track in stream_map.iteritems():
-            self.debug( "Stream: " + str(stream) + "\nTrack :" + str(track) +\
-                        "\n Track duration:" + str(track.duration))
+            self.debug("Stream: %s, Track: %s, Track duration: %d", str(stream),
+                       str(track), track.duration)
             start = max(start, track.duration)
             track_object = SourceTrackObject(factory, stream)
             track.addTrackObject(track_object)
@@ -1689,16 +1689,15 @@ class Timeline(Signallable, Loggable):
 
     def addEffectFactoryOnObject(self, factory, timeline_objects):
         """
-        Add effectTraks corresponding to the effect from the factory to the corresponding
+        Add EffectTracks corresponding to the effect from the factory to the corresponding
         L{TimelineObject}s on the timeline
 
         @param factory: The EffectFactory to add.
         @type factory: L{EffectFactory}
-        @param time: Where the effect should be added, if time = -1, we add the effect
-                     to the whole layer
-        @type time: C{int}
-        @priority: An aproximation of the clip we want the effect to be added to.
-        @type priority: C{int}
+        @timeline_objects: The L{TimelineObject}s on whiches you want to add TrackObjects
+                           corresponding to the L{EffectFactory}
+        @type timeline_objects: A C{List} of L{TimelineObject}s
+
         @raises TimelineError: if the factory doesn't have input or output streams
         @returns: A list of L{TimelineObject}, L{TrackObject} tuples
         """
@@ -1716,16 +1715,17 @@ class Timeline(Signallable, Loggable):
             raise TimelineError()
         input_stream = input_stream[0]
 
-        track = self.getEffectTrack(factory)
+        track = [track for track in self.tracks\
+                if type (track.stream) == type(factory.input_streams[0])][0]
         if track is None:
-          raise TimelineError()
+          raise TimelineError("There is no Track to add the effect to")
 
         if not timeline_objects:
           raise TimelineError("There is no timeline object to add effect to")
 
         listTimelineObjectTrackObject = []
         track_object = TrackEffect(factory, input_stream)
-        track_object.makeBin()
+        track_object.makeBin() #FIXME
 
         for obj in timeline_objects:
             copy_track_obj = track_object.copy()
@@ -1741,9 +1741,6 @@ class Timeline(Signallable, Loggable):
                            for listTo in listTimelineObjectTrackObject])
         return listTimelineObjectTrackObject
 
-    def getEffectTrack(self, factory):
-        return [track for track in self.tracks if type (track.stream) == type(factory.input_streams[0])][0]
-
     def _getSourceFactoryStreamMap(self, factory):
         # track.stream -> track
         track_stream_to_track_map = dict((track.stream, track)
diff --git a/pitivi/timeline/timeline_undo.py b/pitivi/timeline/timeline_undo.py
index 0f8176c..5859a5c 100644
--- a/pitivi/timeline/timeline_undo.py
+++ b/pitivi/timeline/timeline_undo.py
@@ -305,7 +305,7 @@ class ActivePropertyChanged(UndoableAction):
     def undo(self):
         self.effect_action.track_object.active = self.active
         self.active = not self.active
-        self._done()
+        self._undone()
 
 class TimelineLogObserver(object):
     timelinePropertyChangedAction = TimelineObjectPropertyChanged
diff --git a/pitivi/timeline/track.py b/pitivi/timeline/track.py
index c758f86..84233e1 100644
--- a/pitivi/timeline/track.py
+++ b/pitivi/timeline/track.py
@@ -419,7 +419,6 @@ class TrackObject(Signallable, Loggable):
             self.track.addTrackObject(other)
             other.gnl_object.set_property("active",
                                           self.gnl_object.get_property("active"))
-            self._setGstElementProperties(other)
 
         interpolators = self.getInterpolators()
         for property, interpolator in interpolators.itervalues():
@@ -438,9 +437,6 @@ class TrackObject(Signallable, Loggable):
     def snapStartDurationTime(self, *args):
         return
 
-    def _setGstElementProperties(self, other):
-        return
-
     def _getStart(self):
         return self.gnl_object.props.start
 
@@ -540,6 +536,9 @@ class TrackObject(Signallable, Loggable):
             self._updatePriority(priority)
 
     def _updatePriority(self, priority):
+        # The priority of an effect should always be higher than the priority of 
+        # the track it is applied to. Those priority are affected when we add a 
+        # TrackObject to timeline
         if type(self) is TrackEffect:
             if self.stream_type is VideoStream:
                 true_priority = 2 + self._stagger + (3 * priority)
@@ -746,8 +745,10 @@ class TrackEffect(TrackObject):
         TrackEffect.numobjs += 1
         return effect
 
-    def _setGstElementProperties(self, other):
-        if isinstance(self, TrackEffect):
+    def copy(self):
+        other = TrackObject.copy(self)
+
+        if self.track is not None:
             element = self.getElement()
             new_element = other.getElement()
             for prop in gobject.list_properties(element):
@@ -755,6 +756,8 @@ class TrackEffect(TrackObject):
                 if value != prop.default_value:
                     new_element.set_property(prop.name, value)
 
+        return other
+
     def getElement(self):
         """
         Permit to get the gst.Element inside the gnl_object that correspond



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