[pitivi] Finish the port to the new GES API



commit a8f871ee8603a41f7e9809a36a1ab763ef0fc5bb
Author: Jean-FranÃois Fortin Tam <nekohayo gmail com>
Date:   Fri Feb 8 17:00:08 2013 -0500

    Finish the port to the new GES API

 pitivi/application.py       |    2 +-
 pitivi/clipproperties.py    |   30 +++++++++---------
 pitivi/mainwindow.py        |    2 +-
 pitivi/medialibrary.py      |    8 ++--
 pitivi/timeline/timeline.py |   68 +++++++++++++++++++++---------------------
 pitivi/timeline/track.py    |   32 ++++++++++----------
 pitivi/undo/effect.py       |    8 ++--
 pitivi/undo/timeline.py     |   49 ++++++++++++++++--------------
 pitivi/utils/timeline.py    |   20 ++++++------
 9 files changed, 111 insertions(+), 108 deletions(-)
---
diff --git a/pitivi/application.py b/pitivi/application.py
index 311e068..8a61e2d 100644
--- a/pitivi/application.py
+++ b/pitivi/application.py
@@ -350,7 +350,7 @@ class ProjectCreatorGuiPitivi(GuiPitivi):
             self.action_log.begin("add clip")
             src = GES.UriClip(uri=info.get_uri())
             src.set_property("priority", 1)
-            self.current.timeline.get_layers()[0].add_object(src)
+            self.current.timeline.get_layers()[0].add_clip(src)
             self.action_log.commit()
 
     def _discoveryErrorCb(self, medialibrary, uri, error, debug, startup_uris):
diff --git a/pitivi/clipproperties.py b/pitivi/clipproperties.py
index 5832793..e3f45e2 100644
--- a/pitivi/clipproperties.py
+++ b/pitivi/clipproperties.py
@@ -274,8 +274,8 @@ class EffectProperties(Gtk.Expander):
         if selection.selected:
             self.clips = list(selection.selected)
             for clip in self.clips:
-                clip.connect("track-object-added", self._TrackElementAddedCb)
-                clip.connect("track-object-removed", self._trackElementRemovedCb)
+                clip.connect("track-element-added", self._TrackElementAddedCb)
+                clip.connect("track-element-removed", self._trackElementRemovedCb)
             self.show()
         else:
             self.clips = []
@@ -308,7 +308,7 @@ class EffectProperties(Gtk.Expander):
     def _removeEffect(self, effect):
         self.app.action_log.begin("remove effect")
         self._cleanCache(effect)
-        effect.get_track().remove_object(effect)
+        effect.get_track().remove_element(effect)
         effect.get_clip().release_track_element(effect)
         self._updateTreeview()
         self.app.action_log.commit()
@@ -335,7 +335,7 @@ class EffectProperties(Gtk.Expander):
                     self.app.action_log.begin("add effect")
                     effect = GES.Effect(bin_description=bin_desc)
                     clip.add_track_element(effect)
-                    track.add_object(effect)
+                    track.add_element(effect)
                     self.updateAll()
                     self.app.action_log.commit()
                     self.app.current.pipeline.flushSeek()
@@ -475,7 +475,7 @@ class TransformationProperties(Gtk.Expander):
         self.action_log = action_log
         self.app = app
         self._timeline = None
-        self._current_tl_obj = None
+        self._selected_clip = None
         self.spin_buttons = {}
         self.default_values = {}
         self.set_label(_("Transformation"))
@@ -514,7 +514,7 @@ class TransformationProperties(Gtk.Expander):
 
     def _expandedCb(self, expander, params):
         if not "Frei0r" in missing_soft_deps:
-            if self._current_tl_obj:
+            if self._selected_clip:
                 self.effect = self._findOrCreateEffect("frei0r-filter-scale0tilt")
                 self._updateSpinButtons()
                 self.set_expanded(self.get_expanded())
@@ -585,7 +585,7 @@ class TransformationProperties(Gtk.Expander):
         self.app.current.pipeline.flushSeek()
 
     def _findEffect(self, name):
-        for effect in self._current_tl_obj.get_track_elements():
+        for effect in self._selected_clip.get_track_elements():
             if isinstance(effect, GES.BaseEffect):
                 if name in effect.get_property("bin-description"):
                     self.effect = effect
@@ -595,11 +595,11 @@ class TransformationProperties(Gtk.Expander):
         effect = self._findEffect(name)
         if not effect:
             effect = GES.Effect(bin_description=name)
-            self._current_tl_obj.add_track_element(effect)
+            self._selected_clip.add_track_element(effect)
             tracks = self.app.projectManager.current.timeline.get_tracks()
             for track in tracks:
                 if track.get_caps().to_string() == "video/x-raw":
-                    track.add_object(effect)
+                    track.add_element(effect)
             effect = self._findEffect(name)
             # disable the effect on default
             a = self.effect.get_gnlobject()
@@ -611,11 +611,11 @@ class TransformationProperties(Gtk.Expander):
 
     def _selectionChangedCb(self, timeline):
         if self.timeline and len(self.timeline.selection.selected) > 0:
-            for tl_obj in self.timeline.selection.selected:
+            for clip in self.timeline.selection.selected:
                 pass
 
-            if tl_obj != self._current_tl_obj:
-                self._current_tl_obj = tl_obj
+            if clip != self._selected_clip:
+                self._selected_clip = clip
                 self.effect = None
 
             self.show()
@@ -623,8 +623,8 @@ class TransformationProperties(Gtk.Expander):
                 self.effect = self._findOrCreateEffect("frei0r-filter-scale0tilt")
                 self._updateSpinButtons()
         else:
-            if self._current_tl_obj:
-                self._current_tl_obj = None
+            if self._selected_clip:
+                self._selected_clip = None
                 self.zoom_scale.set_value(1.0)
                 self.app.current.pipeline.flushSeek()
             self.effect = None
@@ -632,7 +632,7 @@ class TransformationProperties(Gtk.Expander):
         self._updateBoxVisibility()
 
     def _updateBoxVisibility(self):
-        if self.get_expanded() and self._current_tl_obj:
+        if self.get_expanded() and self._selected_clip:
             self.app.gui.viewer.internal.show_box()
         else:
             self.app.gui.viewer.internal.hide_box()
diff --git a/pitivi/mainwindow.py b/pitivi/mainwindow.py
index 5b827cb..8522030 100644
--- a/pitivi/mainwindow.py
+++ b/pitivi/mainwindow.py
@@ -576,7 +576,7 @@ class PitiviMainWindow(Gtk.Window, Loggable):
             # Don't loop in self.timeline_ui.ui_manager.get_action_groups()
             # otherwise you'll get all the action groups of the application.
             self.timeline_ui.playhead_actions.set_sensitive(sensitive)
-            selected = self.timeline_ui.timeline.selection.getSelectedTrackObjs()
+            selected = self.timeline_ui.timeline.selection.getSelectedTrackElements()
             if not sensitive or (sensitive and selected):
                 self.log("Setting timeline selection actions sensitivity to %s" % sensitive)
                 self.timeline_ui.selection_actions.set_sensitive(sensitive)
diff --git a/pitivi/medialibrary.py b/pitivi/medialibrary.py
index 4e6adaa..826efc9 100644
--- a/pitivi/medialibrary.py
+++ b/pitivi/medialibrary.py
@@ -341,14 +341,14 @@ class MediaLibraryWidget(Gtk.VBox, Loggable):
         """
         self.app.gui.setActionsSensitive(True)
 
-    def _trackElementAddedCb(self, source, trackobj):
+    def _trackElementAddedCb(self, source, unused_track_element):
         """ After an object has been added to the first track, position it
         correctly and request the next source to be processed. """
         timeline = self.app.current.timeline
         layer = timeline.get_layers()[0]  # FIXME Get the longest layer
 
         # Handle the case where we just inserted the first clip
-        if len(layer.get_objects()) == 1:
+        if len(layer.get_clips()) == 1:
             source.props.start = 0
         else:
             source.props.start = timeline.props.duration
@@ -687,7 +687,7 @@ class MediaLibraryWidget(Gtk.VBox, Loggable):
         """Check if a given URI is present in the timeline"""
         layers = self.app.current.timeline.get_layers()
         for layer in layers:
-            for clip in layer.get_objects():
+            for clip in layer.get_clips():
                 if clip.get_asset() == asset:
                     return True
         return False
@@ -703,7 +703,7 @@ class MediaLibraryWidget(Gtk.VBox, Loggable):
         selection = self.treeview.get_selection()
         for asset in assets:
             if not self._sourceIsUsed(asset):
-                unused_sources_uris.append(asset.get_uri())
+                unused_sources_uris.append(asset.get_id())
 
         # Hack around the fact that making selections (in a treeview/iconview)
         # deselects what was previously selected
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index f809d29..8fd1000 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -349,11 +349,11 @@ class TimelineCanvas(GooCanvas.Canvas, Zoomable, Loggable):
                 mode = 1
             if event.get_state()[1] & Gdk.ModifierType.CONTROL_MASK:
                 mode = 2
-            selected = self._objectsUnderMarquee()
-            self._timeline.selection.setSelection(self._objectsUnderMarquee(), mode)
+            selected = self._elementsUnderMarquee()
+            self._timeline.selection.setSelection(self._elementsUnderMarquee(), mode)
         return True
 
-    def _objectsUnderMarquee(self):
+    def _elementsUnderMarquee(self):
         items = self.get_items_in_area(self._marquee.get_bounds(), True, True, True)
         if items:
             return set((item.element for item in items if isinstance(item,
@@ -938,7 +938,7 @@ class Timeline(Gtk.Table, Loggable, Zoomable):
         self._updateZoomSlider = True
         self.ui_manager = ui_manager
         self.app = instance
-        self._temp_objects = []
+        self._temp_elements = []
         self._drag_started = False
         self._factories = None
         self._finish_drag = False
@@ -1170,16 +1170,16 @@ class Timeline(Gtk.Table, Loggable, Zoomable):
         if not self._drag_started:
             self._drag_started = True
         elif context.list_targets() not in DND_EFFECT_LIST and self.app.gui.medialibrary.dragged:
-            if not self._temp_objects:
+            if not self._temp_elements:
                 self._create_temp_source(x, y)
 
             # Let some time for TrackElement-s to be created
-            if self._temp_objects:
-                focus = self._temp_objects[0]
+            if self._temp_elements:
+                focus = self._temp_elements[0]
                 if self._move_context is None:
                     self._move_context = EditingContext(focus,
                             self.timeline, GES.EditMode.EDIT_NORMAL, GES.Edge.EDGE_NONE,
-                            set(self._temp_objects[1:]), self.app.settings)
+                            set(self._temp_elements[1:]), self.app.settings)
 
                 self._move_temp_source(x, y)
         return True
@@ -1208,11 +1208,11 @@ class Timeline(Gtk.Table, Loggable, Zoomable):
             self._factories = []
             if context.list_targets() not in DND_EFFECT_LIST:
                 self.timeline.enable_update(True)
-                self.debug("Need to cleanup %d objects" % len(self._temp_objects))
-                for obj in self._temp_objects:
+                self.debug("Need to cleanup %d elements" % len(self._temp_elements))
+                for obj in self._temp_elements:
                     layer = obj.get_layer()
-                    layer.remove_object(obj)
-                self._temp_objects = []
+                    layer.remove_clip(obj)
+                self._temp_elements = []
                 self._move_context = None
 
             self.debug("Drag cleanup ended")
@@ -1234,21 +1234,21 @@ class Timeline(Gtk.Table, Loggable, Zoomable):
             # The temporary objects and factories that we had created
             # in _dragMotionCb are now kept for good.
             # Clear the temporary references to objects, as they are real now.
-            self._temp_objects = []
+            self._temp_elements = []
             self._factories = []
             #context.drop_finish(True, timestamp)
         else:
             if self.app.current.timeline.props.duration == 0:
                 return False
-            timeline_objs = self._getClipUnderMouse(x, y)
-            if timeline_objs:
+            clips = self._getClipsUnderMouse(x, y)
+            if clips:
                 # FIXME make a util function to add effects
                 # instead of copy/pasting it from cliproperties
                 bin_desc = self.app.gui.effectlist.getSelectedItems()
                 media_type = self.app.effects.getFactoryFromName(bin_desc).media_type
 
                 # Trying to apply effect only on the first object of the selection
-                clip = timeline_objs[0]
+                clip = clips[0]
 
                 # Checking that this effect can be applied on this track object
                 # Which means, it has the corresponding media_type
@@ -1262,26 +1262,26 @@ class Timeline(Gtk.Table, Loggable, Zoomable):
                         self.app.action_log.begin("add effect")
                         effect = GES.Effect(bin_description=bin_desc)
                         clip.add_track_element(effect)
-                        track.add_object(effect)
+                        track.add_element(effect)
                         self.app.gui.clipconfig.effect_expander.updateAll()
                         self.app.action_log.commit()
                         self._factories = None
                         self._seeker.flush()
 
-                        self.timeline.selection.setSelection(timeline_objs, SELECT)
+                        self.timeline.selection.setSelection(clips, SELECT)
                         break
         Gtk.drag_finish(context, True, False, timestamp)
         return True
 
-    def _getClipUnderMouse(self, x, y):
-        timeline_objs = []
+    def _getClipsUnderMouse(self, x, y):
+        clips = []
         items_in_area = self._canvas.getItemsInArea(x, y, x + 1, y + 1)
 
         track_elements = [obj for obj in items_in_area[1]]
         for track_element in track_elements:
-            timeline_objs.append(track_element.get_clip())
+            clips.append(track_element.get_clip())
 
-        return timeline_objs
+        return clips
 
     def _showSaveScreenshotDialog(self):
         """
@@ -1339,10 +1339,10 @@ class Timeline(Gtk.Table, Loggable, Zoomable):
         quoted_uri = quote_uri(uri)
         layers = self.timeline.get_layers()
         for layer in layers:
-            for clip in layer.get_objects():
+            for clip in layer.get_clips():
                 if hasattr(clip, "get_uri"):
                     if quote_uri(clip.get_uri()) == quoted_uri:
-                        layer.remove_object(clip)
+                        layer.remove_clip(clip)
                 else:
                     # TimelineStandardTransition and the like don't have URIs
                     # GES will remove those transitions automatically.
@@ -1365,7 +1365,7 @@ class Timeline(Gtk.Table, Loggable, Zoomable):
             source = layer.add_asset(asset, start, 0,
                 clip_duration, 1.0, asset.get_supported_formats())
 
-            self._temp_objects.insert(0, source)
+            self._temp_elements.insert(0, source)
             start += asset.get_duration()
 
     def _move_temp_source(self, x, y):
@@ -1730,9 +1730,9 @@ class Timeline(Gtk.Table, Loggable, Zoomable):
         if self.timeline:
             self.app.action_log.begin("delete clip")
             #FIXME GES port: Handle unlocked TrackElement-s
-            for obj in self.timeline.selection:
-                layer = obj.get_layer()
-                layer.remove_object(obj)
+            for clip in self.timeline.selection:
+                layer = clip.get_layer()
+                layer.remove_clip(clip)
             self.app.action_log.commit()
 
     def ungroupSelected(self, unused_action):
@@ -1780,12 +1780,12 @@ class Timeline(Gtk.Table, Loggable, Zoomable):
         self.timeline.enable_update(False)
         position = self.app.current.pipeline.getPosition()
         for track in self.timeline.get_tracks():
-            for tck_obj in track.get_objects():
-                start = tck_obj.get_start()
-                end = start + tck_obj.get_duration()
+            for element in track.get_elements():
+                start = element.get_start()
+                end = start + element.get_duration()
                 if start < position and end > position:
-                    obj = tck_obj.get_clip()
-                    obj.split(position)
+                    clip = element.get_clip()
+                    clip.split(position)
         self.timeline.enable_update(True)
 
     def keyframe(self, action):
@@ -1794,7 +1794,7 @@ class Timeline(Gtk.Table, Loggable, Zoomable):
 
         FIXME GES: this method is currently not used anywhere
         """
-        selected = self.timeline.selection.getSelectedTrackObjs()
+        selected = self.timeline.selection.getSelectedTrackElements()
         for obj in selected:
             keyframe_exists = False
             position = self.app.current.pipeline.getPosition()
diff --git a/pitivi/timeline/track.py b/pitivi/timeline/track.py
index 6d61d46..a06f9b3 100644
--- a/pitivi/timeline/track.py
+++ b/pitivi/timeline/track.py
@@ -391,7 +391,7 @@ class TrackElement(View, GooCanvas.CanvasGroup, Zoomable, Loggable):
 
             self._context = EditingContext(self._view.element,
                 self._view.timeline, GES.EditMode.EDIT_NORMAL, GES.Edge.EDGE_NONE,
-                self._view.timeline.selection.getSelectedTrackObjs(),
+                self._view.timeline.selection.getSelectedTrackElements(),
                 self.app.settings)
 
             self._view.app.action_log.begin("move object")
@@ -621,11 +621,11 @@ class TrackElement(View, GooCanvas.CanvasGroup, Zoomable, Loggable):
                 if self.element.get_track().get_property("track_type") == GES.TrackType.VIDEO:
                     has_text_overlay = False
                     clip = self.element.get_clip()
-                    trackobjs = clip.get_track_elements()
-                    for trackobj in trackobjs:
-                        if isinstance(trackobj, GES.TextOverlay):
+                    elements = clip.get_track_elements()
+                    for element in elements:
+                        if isinstance(element, GES.TextOverlay):
                             has_text_overlay = True
-                            title = trackobj
+                            title = element
                     if not has_text_overlay:
                         title = GES.TextOverlay()
                         title.set_text("")
@@ -633,7 +633,7 @@ class TrackElement(View, GooCanvas.CanvasGroup, Zoomable, Loggable):
                         title.set_duration(self.element.duration)
                         # FIXME: Creating a text overlay everytime we select a video track object is madness
                         self.element.get_clip().add_track_element(title)
-                        self.element.get_track().add_object(title)
+                        self.element.get_track().add_element(title)
                     self.app.gui.title_editor.set_source(title)
                 self.app.gui.trans_list.deactivate()
                 self.app.gui.switchContextTab()
@@ -820,21 +820,21 @@ class Track(GooCanvas.CanvasGroup, Zoomable, Loggable):
 
     def setTrack(self, track):
         if self._track:
-            self._track.disconnect_by_func(self._objectAddedCb)
-            self._track.disconnect_by_func(self._objectRemovedCb)
-            for trackobj in self._track.get_objects():
-                self._objectRemovedCb(None, trackobj)
+            self._track.disconnect_by_func(self._elementAddedCb)
+            self._track.disconnect_by_func(self._elementRemovedCb)
+            for element in self._track.get_elements():
+                self._elementRemovedCb(None, element)
 
         self._track = track
         if track:
-            for trackobj in self.track.get_objects():
-                self._objectAddedCb(None, trackobj)
-            self._track.connect("track-object-added", self._objectAddedCb)
-            self._track.connect("track-object-removed", self._objectRemovedCb)
+            for element in self.track.get_elements():
+                self._elementAddedCb(None, element)
+            self._track.connect("track-element-added", self._elementAddedCb)
+            self._track.connect("track-element-removed", self._elementRemovedCb)
 
     track = property(getTrack, setTrack, None, "The timeline property")
 
-    def _objectAddedCb(self, unused_timeline, track_element):
+    def _elementAddedCb(self, unused_timeline, track_element):
         if isinstance(track_element, GES.Transition):
             self._transitionAdded(track_element)
         elif isinstance(track_element, GES.TitleSource):
@@ -846,7 +846,7 @@ class Track(GooCanvas.CanvasGroup, Zoomable, Loggable):
             self.widgets[track_element] = w
             self.add_child(w, -1)
 
-    def _objectRemovedCb(self, unused_timeline, track_element):
+    def _elementRemovedCb(self, unused_timeline, track_element):
         if not isinstance(track_element, GES.BaseEffect) and track_element in self.widgets:
             w = self.widgets[track_element]
             del self.widgets[track_element]
diff --git a/pitivi/undo/effect.py b/pitivi/undo/effect.py
index 3382782..7e50d78 100644
--- a/pitivi/undo/effect.py
+++ b/pitivi/undo/effect.py
@@ -114,10 +114,10 @@ class EffectAdded(UndoableAction):
 
     def do(self):
         timeline = self.clip.timeline
-        tl_obj_track_obj = timeline.addEffectFactoryOnObject(self.factory,
+        clip_track_element = timeline.addEffectFactoryOnObject(self.factory,
                                             clips=[self.clip])
 
-        self.track_element = tl_obj_track_obj[0][1]
+        self.track_element = clip_track_element[0][1]
         element = self.track_element.getElement()
         for prop_name, prop_value in self.effect_props:
             element.set_property(prop_name, prop_value)
@@ -187,10 +187,10 @@ class EffectRemoved(UndoableAction):
 
     def undo(self):
         timeline = self.clip.timeline
-        tl_obj_track_obj = timeline.addEffectFactoryOnObject(self.factory,
+        clip_track_element = timeline.addEffectFactoryOnObject(self.factory,
                                             clips=[self.clip])
 
-        self.track_element = tl_obj_track_obj[0][1]
+        self.track_element = clip_track_element[0][1]
         element = self.track_element.getElement()
         for prop_name, prop_value in self.effect_props:
             element.set_property(prop_name, prop_value)
diff --git a/pitivi/undo/timeline.py b/pitivi/undo/timeline.py
index 87e116d..4739d62 100644
--- a/pitivi/undo/timeline.py
+++ b/pitivi/undo/timeline.py
@@ -231,8 +231,8 @@ class ActivePropertyChanged(UndoableAction):
 
 class TimelineLogObserver(object):
     timelinePropertyChangedAction = ClipPropertyChanged
-    timelineObjectAddedAction = ClipAdded
-    timelineObjectRemovedAction = ClipRemoved
+    ClipAddedAction = ClipAdded
+    ClipRemovedAction = ClipRemoved
     effectAddAction = EffectAdded
     effectRemovedAction = EffectRemoved
     interpolatorKeyframeAddedAction = InterpolatorKeyframeAdded
@@ -259,7 +259,7 @@ class TimelineLogObserver(object):
     def startObserving(self, timeline):
         self._connectToTimeline(timeline)
         for layer in timeline.get_layers():
-            for clip in layer.get_objects():
+            for clip in layer.get_clips():
                 self._connectToClip(clip)
                 for track_element in clip.track_elements:
                     self._connectToTrackElement(track_element)
@@ -273,32 +273,33 @@ class TimelineLogObserver(object):
 
     def _connectToTimeline(self, timeline):
         for layer in timeline.get_layers():
-            layer.connect("object-added", self._timelineObjectAddedCb)
-            layer.connect("object-removed", self._timelineObjectRemovedCb)
+            layer.connect("clip-added", self._clipAddedCb)
+            layer.connect("clip-removed", self._clipRemovedCb)
 
     def _disconnectFromTimeline(self, timeline):
-        timeline.disconnect_by_func(self._timelineObjectAddedCb)
-        timeline.disconnect_by_func(self._timelineObjectRemovedCb)
+        timeline.disconnect_by_func(self._clipAddedCb)
+        timeline.disconnect_by_func(self._clipRemovedCb)
 
     def _connectToClip(self, clip):
         tracker = ClipPropertyChangeTracker()
         tracker.connectToObject(clip)
         for property_name in tracker.property_names:
             tracker.connect("notify::" + property_name,
-                    self._timelineObjectPropertyChangedCb, property_name)
+                    self._clipPropertyChangedCb, property_name)
         self.clip_property_trackers[clip] = tracker
 
-        clip.connect("track-object-added", self._timelineObjectTrackElementAddedCb)
-        #clip.connect("track-object-removed", self._timelineObjectTrackElementRemovedCb)
-        for obj in clip.get_track_elements():
-            self._connectToTrackElement(obj)
+        clip.connect("track-element-added", self._clipTrackElementAddedCb)
+        clip.connect("track-element-removed", self._clipTrackElementRemovedCb)
+        for element in clip.get_track_elements():
+            self._connectToTrackElement(element)
 
     def _disconnectFromClip(self, clip):
         tracker = self.clip_property_trackers.pop(clip)
         tracker.disconnectFromObject(clip)
-        tracker.disconnect_by_func(self._timelineObjectPropertyChangedCb)
+        tracker.disconnect_by_func(self._clipPropertyChangedCb)
 
     def _connectToTrackElement(self, track_element):
+        # FIXME: keyframes are disabled:
         #for prop, interpolator in track_element.getInterpolators().itervalues():
             #self._connectToInterpolator(interpolator)
         if isinstance(track_element, GES.BaseEffect):
@@ -323,28 +324,28 @@ class TimelineLogObserver(object):
         tracker.disconnectFromObject(interpolator)
         tracker.disconnect_by_func(self._interpolatorKeyframeMovedCb)
 
-    def _timelineObjectAddedCb(self, timeline, clip):
+    def _clipAddedCb(self, timeline, clip):
         self._connectToClip(clip)
-        action = self.timelineObjectAddedAction(timeline, clip)
+        action = self.ClipAddedAction(timeline, clip)
         self.log.push(action)
 
-    def _timelineObjectRemovedCb(self, timeline, clip):
+    def _clipRemovedCb(self, timeline, clip):
         self._disconnectFromClip(clip)
-        action = self.timelineObjectRemovedAction(timeline, clip)
+        action = self.ClipRemovedAction(timeline, clip)
         self.log.push(action)
 
-    def _timelineObjectPropertyChangedCb(self, tracker, clip,
+    def _clipPropertyChangedCb(self, tracker, clip,
             old_value, new_value, property_name):
         action = self.timelinePropertyChangedAction(clip,
                 property_name, old_value, new_value)
         self.log.push(action)
 
-    def _timelineObjectTrackElementAddedCb(self, clip, track_element):
+    def _clipTrackElementAddedCb(self, clip, track_element):
         if isinstance(track_element, GES.BaseEffect):
             action = self.effectAddAction(clip, track_element,
                                           self.effect_properties_tracker)
-            #We use the action instead of the track object
-            #because the track_element changes when redoing
+            # We use the action instead of the track element
+            # because the track_element changes when redoing
             track_element.connect("active-changed",
                                  self._trackElementActiveChangedCb, action)
             self.log.push(action)
@@ -354,8 +355,7 @@ class TimelineLogObserver(object):
         else:
             self._connectToTrackElement(track_element)
 
-    def _timelineObjectTrackElementRemovedCb(self, clip,
-                                            track_element):
+    def _clipTrackElementRemovedCb(self, clip, track_element):
         if isinstance(track_element, GES.BaseEffect):
             action = self.effectRemovedAction(clip,
                                               track_element,
@@ -374,6 +374,9 @@ class TimelineLogObserver(object):
         self.log.push(action)
 
     def _trackElementActiveChangedCb(self, track_element, active, add_effect_action):
+        """
+        This happens when an effect is (de)activated on a clip in the timeline.
+        """
         action = self.activePropertyChangedAction(add_effect_action, active)
         self.log.push(action)
 
diff --git a/pitivi/utils/timeline.py b/pitivi/utils/timeline.py
index 2f07df9..34ae031 100644
--- a/pitivi/utils/timeline.py
+++ b/pitivi/utils/timeline.py
@@ -125,18 +125,18 @@ class Selection(Signallable):
             self.last_single_obj = iter(selection).next()
 
         for obj in old_selection - self.selected:
-            for track_element in obj.get_track_elements():
-                if not isinstance(track_element, GES.BaseEffect) and not isinstance(track_element, 
GES.TextOverlay):
-                    track_element.selected.selected = False
+            for element in obj.get_track_elements():
+                if not isinstance(element, GES.BaseEffect) and not isinstance(element, GES.TextOverlay):
+                    element.selected.selected = False
 
         for obj in self.selected - old_selection:
-            for track_element in obj.get_track_elements():
-                if not isinstance(track_element, GES.BaseEffect) and not isinstance(track_element, 
GES.TextOverlay):
-                    track_element.selected.selected = True
+            for element in obj.get_track_elements():
+                if not isinstance(element, GES.BaseEffect) and not isinstance(element, GES.TextOverlay):
+                    element.selected.selected = True
 
         self.emit("selection-changed")
 
-    def getSelectedTrackObjs(self):
+    def getSelectedTrackElements(self):
         """
         Returns the list of L{TrackElement} contained in this selection.
         """
@@ -152,9 +152,9 @@ class Selection(Signallable):
         """
         effects = []
         for clip in self.selected:
-            for track in clip.get_track_elements():
-                if isinstance(track, GES.BaseEffect):
-                    effects.append(track)
+            for element in clip.get_track_elements():
+                if isinstance(element, GES.BaseEffect):
+                    effects.append(element)
 
         return effects
 


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