[pitivi] GES is now responsible for removing GESTrackElement from tracks



commit 50b3221e19203ca41966ff1e441943df00b96bbf
Author: Thibault Saunier <thibault saunier collabora com>
Date:   Fri Mar 22 19:58:59 2013 -0300

    GES is now responsible for removing GESTrackElement from tracks
    
      + Use the GESTrackElement.get_track_type() method where appropriate

 pitivi/clipproperties.py    |   15 ++++++---------
 pitivi/timeline/timeline.py |    8 +++-----
 pitivi/timeline/track.py    |    6 +++---
 3 files changed, 12 insertions(+), 17 deletions(-)
---
diff --git a/pitivi/clipproperties.py b/pitivi/clipproperties.py
index a51f606..d785c76 100644
--- a/pitivi/clipproperties.py
+++ b/pitivi/clipproperties.py
@@ -313,7 +313,6 @@ class EffectProperties(Gtk.Expander, Loggable):
     def _removeEffect(self, effect):
         self.app.action_log.begin("remove effect")
         self._cleanCache(effect)
-        effect.get_track().remove_element(effect)
         effect.get_parent().remove(effect)
         self._updateTreeview()
         self.app.action_log.commit()
@@ -331,11 +330,9 @@ class EffectProperties(Gtk.Expander, Loggable):
             # Checking that this effect can be applied on this track object
             # Which means, it has the corresponding media_type
             for track_element in clip.get_children():
-                track = track_element.get_track()
-                if track.get_property("track_type") == GES.TrackType.AUDIO and \
-                        media_type == AUDIO_EFFECT or \
-                        track.get_property("track_type") == GES.TrackType.VIDEO and \
-                        media_type == VIDEO_EFFECT:
+                track_type = track_element.get_track_type()
+                if track_type == GES.TrackType.AUDIO and media_type == AUDIO_EFFECT or \
+                        track_type == GES.TrackType.VIDEO and media_type == VIDEO_EFFECT:
                     #Actually add the effect
                     self.app.action_log.begin("add effect")
                     effect = GES.Effect.new(bin_description=bin_desc)
@@ -404,10 +401,10 @@ class EffectProperties(Gtk.Expander, Loggable):
                 asset = self.app.effects.getFactoryFromName(
                     effect.props.bin_description)
                 to_append = [effect.props.active]
-                track = effect.get_track()
-                if track.get_property("track_type") == GES.TrackType.AUDIO:
+                track_type = effect.get_track_type()
+                if track_type == GES.TrackType.AUDIO:
                     to_append.append("Audio")
-                elif track.get_property("track_type") == GES.TrackType.VIDEO:
+                elif track_type == GES.TrackType.VIDEO:
                     to_append.append("Video")
 
                 to_append.append(effect.props.bin_description)
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index 8110731..24a3a6e 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -1253,11 +1253,9 @@ class Timeline(Gtk.Table, Loggable, Zoomable):
                 # Checking that this effect can be applied on this track object
                 # Which means, it has the corresponding media_type
                 for track_element in clip.get_children():
-                    track = track_element.get_track()
-                    if track.get_property("track_type") == GES.TrackType.AUDIO and \
-                            media_type == AUDIO_EFFECT or \
-                            track.get_property("track_type") == GES.TrackType.VIDEO and \
-                            media_type == VIDEO_EFFECT:
+                    track_type = track_element.get_track_type()
+                    if track_type == GES.TrackType.AUDIO and media_type == AUDIO_EFFECT or \
+                            track_type == GES.TrackType.VIDEO and media_type == VIDEO_EFFECT:
                         #Actually add the effect
                         self.app.action_log.begin("add effect")
                         effect = GES.Effect.new(bin_description=bin_desc)
diff --git a/pitivi/timeline/track.py b/pitivi/timeline/track.py
index a0fc832..59e7057 100644
--- a/pitivi/timeline/track.py
+++ b/pitivi/timeline/track.py
@@ -618,7 +618,7 @@ class TrackElement(View, GooCanvas.CanvasGroup, Zoomable, Loggable):
                 self.app.gui.switchContextTab("title editor")
                 self.app.gui.title_editor.set_source(self.element.get_parent())
             else:
-                if self.element.get_track().get_property("track_type") == GES.TrackType.VIDEO:
+                if self.element.get_track_type() == GES.TrackType.VIDEO:
                     has_text_overlay = False
                     clip = self.element.get_parent()
                     elements = clip.get_children()
@@ -650,7 +650,7 @@ class TrackElement(View, GooCanvas.CanvasGroup, Zoomable, Loggable):
 
         # get layer and track_type
         layer = self.element.get_parent().get_layer()
-        track_type = self.element.get_track().get_property("track-type")
+        track_type = self.element.get_track_type()
 
         # update height, compare with current height to not run into recursion
         new_height = self.app.gui.timeline_ui.controls.getHeightOfLayer(track_type, layer)
@@ -770,7 +770,7 @@ class UriSource(TrackElement):
             self._update()
 
     def _getColor(self):
-        if self.element.get_track().get_property("track-type") == GES.TrackType.AUDIO:
+        if self.element.get_track_type() == GES.TrackType.AUDIO:
             return self.settings.audioClipBg
         else:
             return self.settings.videoClipBg


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