[pitivi] Add a TrackEffect.getElement method that permit to get the effect element in the gnl_object



commit 1792ee471911158d8a12bde7474c4589a5f0a9c4
Author: Thibault Saunier <tsaunier gnome org>
Date:   Fri Jul 16 22:53:43 2010 -0400

    Add a TrackEffect.getElement method that permit to get the effect element in the gnl_object

 pitivi/timeline/track.py    |   11 +++++++++++
 pitivi/ui/clipproperties.py |   11 ++++-------
 2 files changed, 15 insertions(+), 7 deletions(-)
---
diff --git a/pitivi/timeline/track.py b/pitivi/timeline/track.py
index 70c7f9c..ec696a4 100644
--- a/pitivi/timeline/track.py
+++ b/pitivi/timeline/track.py
@@ -727,6 +727,17 @@ class TrackEffect(TrackObject):
         TrackEffect.numobjs += 1
         return effect
 
+    def getElement(self):
+        """
+        Permit to get the gst.Element inside the gnl_object that correspond
+        to the track factory
+        """
+        #Should we find a better implementation?
+        for element in self.gnl_object.recurse():
+            if self.factory.name in element.get_name():
+                break
+        return element
+
 class Transition(Signallable):
 
     __signals__ = {
diff --git a/pitivi/ui/clipproperties.py b/pitivi/ui/clipproperties.py
index ba6def7..5806a91 100644
--- a/pitivi/ui/clipproperties.py
+++ b/pitivi/ui/clipproperties.py
@@ -87,7 +87,7 @@ class EffectProperties(gtk.Expander):
         self.effectsHandler = self.app.effects
         self._effect_config_ui = None
         self.pipeline = None
-        self.effect_properties_handling = effect_properties_handling
+        self.effect_props_handling = effect_properties_handling
 
         self.VContent = gtk.VBox()
         self.add(self.VContent)
@@ -326,16 +326,13 @@ class EffectProperties(gtk.Expander):
         if self.selection.get_selected()[1]:
             effect = self.storemodel.get_value(self.selection.get_selected()[1],
                                                COL_TRACK_EFFECT)
-            #TODO figure out the name of the element better
-            for element in effect.gnl_object.recurse():
-                if effect.factory.name in element.get_name():
-                    break
 
             if self._effect_config_ui:
                 self._effect_config_ui.hide()
 
-            config_ui = self.effect_properties_handling.getEffectConfigurationUI(element)
-            self._effect_config_ui =  config_ui
+            element = effect.getElement()
+            ui = self.effect_props_handling.getEffectConfigurationUI(element)
+            self._effect_config_ui = ui
             if self._effect_config_ui:
                 self.VContent.pack_start(self._effect_config_ui,
                                          expand=False,



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