[pitivi/ges: 100/287] pitivi: Make use of the ges enum instead of hacky around.



commit 4c1d3cfebb255a5c85ee530205f1e7a9c7db111e
Author: Thibault Saunier <thibault saunier collabora com>
Date:   Thu Dec 22 14:59:51 2011 +0100

    pitivi: Make use of the ges enum instead of hacky around.
    
    We got a "bindings: Register the various enums/flags in python" patch in ges so
    we are all fine with it.

 pitivi/ui/clipproperties.py |   13 ++++++-------
 pitivi/ui/timeline.py       |    5 ++---
 pitivi/ui/track.py          |    7 -------
 3 files changed, 8 insertions(+), 17 deletions(-)
---
diff --git a/pitivi/ui/clipproperties.py b/pitivi/ui/clipproperties.py
index 4a07b33..5cdf220 100644
--- a/pitivi/ui/clipproperties.py
+++ b/pitivi/ui/clipproperties.py
@@ -37,7 +37,6 @@ from pitivi.log.loggable import Loggable
 from pitivi.effects import AUDIO_EFFECT, VIDEO_EFFECT
 
 
-from pitivi.ui.track import track_is_type
 from pitivi.ui.depsmanager import DepsManager
 from pitivi.ui.common import PADDING, SPACING
 from pitivi.ui.effectlist import HIDDEN_EFFECTS
@@ -58,10 +57,10 @@ class ClipPropertiesError(Exception):
 
 def compare_type(track, effect_type):
 
-    if track_is_type(track, 'GES_TRACK_TYPE_AUDIO') and \
+    if track.props.track_type == ges.TRACK_TYPE_AUDIO and \
             effect_type == AUDIO_EFFECT:
         return True
-    elif track_is_type(track, 'GES_TRACK_TYPE_VIDEO') and \
+    elif track.props.track_type == ges.TRACK_TYPE_VIDEO and \
              effect_type == VIDEO_EFFECT:
         return True
     return False
@@ -343,9 +342,9 @@ class EffectProperties(gtk.Expander, gtk.HBox):
             # Which means, it has the corresponding media_type
             for tckobj in tlobj.get_track_objects():
                 track = tckobj.get_track()
-                if track_is_type(track, 'GES_TRACK_TYPE_AUDIO') and \
+                if track.props.track_type == ges.TRACK_TYPE_AUDIO and \
                         media_type == AUDIO_EFFECT or \
-                        track_is_type(track, 'GES_TRACK_TYPE_VIDEO') and \
+                        track.props.track_type == ges.TRACK_TYPE_VIDEO and \
                         media_type == VIDEO_EFFECT:
                     #Actually add the effect
                     self.app.action_log.begin("add effect")
@@ -425,9 +424,9 @@ class EffectProperties(gtk.Expander, gtk.HBox):
                         track_effect.props.bin_description)
                 to_append = [track_effect.props.active]
                 track = track_effect.get_track()
-                if track_is_type(track, 'GES_TRACK_TYPE_AUDIO'):
+                if track.props.track_type == ges.TRACK_TYPE_AUDIO:
                     to_append.append("Audio")
-                elif track_is_type(track, 'GES_TRACK_TYPE_VIDEO'):
+                elif track.props.track_type == ges.TRACK_TYPE_VIDEO:
                     to_append.append("Video")
 
                 to_append.append(track_effect.props.bin_description)
diff --git a/pitivi/ui/timeline.py b/pitivi/ui/timeline.py
index 430a57a..1a5ccdd 100644
--- a/pitivi/ui/timeline.py
+++ b/pitivi/ui/timeline.py
@@ -42,7 +42,6 @@ from pitivi.effects import AUDIO_EFFECT, VIDEO_EFFECT
 from pitivi.timeline.timeline import MoveContext, SELECT
 
 from pitivi.ui.common import SPACING
-from pitivi.ui.track import track_is_type
 from pitivi.ui.depsmanager import DepsManager
 from pitivi.ui.filelisterrordialog import FileListErrorDialog
 from pitivi.ui.alignmentprogress import AlignmentProgressDialog
@@ -462,9 +461,9 @@ class Timeline(gtk.Table, Loggable, Zoomable):
                 # Which means, it has the corresponding media_type
                 for tckobj in tlobj.get_track_objects():
                     track = tckobj.get_track()
-                    if track_is_type(track, 'GES_TRACK_TYPE_AUDIO') and \
+                    if track.props.track_type == ges.TRACK_TYPE_AUDIO and \
                             media_type == AUDIO_EFFECT or \
-                            track_is_type(track, 'GES_TRACK_TYPE_VIDEO') and \
+                            track.props.track_objects == ges.TRACK_TYPE_VIDEO and \
                             media_type == VIDEO_EFFECT:
                         #Actually add the effect
                         self.app.action_log.begin("add effect")
diff --git a/pitivi/ui/track.py b/pitivi/ui/track.py
index 1c148a0..c316e6f 100644
--- a/pitivi/ui/track.py
+++ b/pitivi/ui/track.py
@@ -32,13 +32,6 @@ from pitivi.ui.common import LAYER_HEIGHT_EXPANDED,\
         LAYER_HEIGHT_COLLAPSED, LAYER_SPACING
 
 
-def track_is_type(track, type_str):
-    """
-    Simple utility function to check the type of a ges.Track
-    """
-    return track.props.track_type.first_value_name == type_str
-
-
 class Transition(goocanvas.Rect, Zoomable):
 
     def __init__(self, transition):



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