[pitivi] Use GES enums instead of strings



commit b1584ceac227615c5a107512bcf8d4663db653a2
Author: Paul Lange <palango gmx de>
Date:   Tue Jun 19 16:02:58 2012 +0200

    Use GES enums instead of strings

 pitivi/timeline/layer.py    |    9 +++++----
 pitivi/timeline/timeline.py |   15 +++++++--------
 2 files changed, 12 insertions(+), 12 deletions(-)
---
diff --git a/pitivi/timeline/layer.py b/pitivi/timeline/layer.py
index a3821d5..ea5fc59 100644
--- a/pitivi/timeline/layer.py
+++ b/pitivi/timeline/layer.py
@@ -21,6 +21,7 @@
 # Boston, MA 02110-1301, USA.
 
 import gtk
+import ges
 import gobject
 
 from gettext import gettext as _
@@ -47,8 +48,8 @@ class BaseLayerControl(gtk.Table, Loggable):
         self.set_row_spacings(3)
         self.set_col_spacings(3)
 
-        icon_mapping = {"audio": "audio-x-generic",
-                        "video": "video-x-generic"}
+        icon_mapping = {ges.TRACK_TYPE_AUDIO: "audio-x-generic",
+                        ges.TRACK_TYPE_VIDEO: "video-x-generic"}
 
         # Folding button
         # TODO use images
@@ -114,7 +115,7 @@ class VideoLayerControl(BaseLayerControl):
     __gtype_name__ = 'VideoLayerControl'
 
     def __init__(self, layer):
-        BaseLayerControl.__init__(self, layer, "video")
+        BaseLayerControl.__init__(self, layer, ges.TRACK_TYPE_VIDEO)
 
         opacity = gtk.Label(_("Opacity:"))
 
@@ -138,7 +139,7 @@ class AudioLayerControl(BaseLayerControl):
     __gtype_name__ = 'AudioLayerControl'
 
     def __init__(self, layer):
-        BaseLayerControl.__init__(self, layer, "audio")
+        BaseLayerControl.__init__(self, layer, ges.TRACK_TYPE_AUDIO)
 
         volume = gtk.Label(_("Vol:"))
         self.volume_button = gtk.VolumeButton()
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index cf93a0a..9a5c4b3 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -527,7 +527,8 @@ class TimelineControls(gtk.VBox, Loggable):
         video_control = VideoLayerControl(layer)
         audio_control = AudioLayerControl(layer)
 
-        map = {"audio": audio_control, "video": video_control}
+        map = {ges.TRACK_TYPE_AUDIO: audio_control,
+               ges.TRACK_TYPE_VIDEO: video_control}
         self._track_controls[layer] = map
 
         self.pack_start(video_control, False, False)
@@ -550,8 +551,8 @@ class TimelineControls(gtk.VBox, Loggable):
                 j += 1
 
     def _layerRemovedCb(self, timeline, layer):
-        audio_control = self._track_controls[layer]["audio"]
-        video_control = self._track_controls[layer]["video"]
+        audio_control = self._track_controls[layer][ges.TRACK_TYPE_AUDIO]
+        video_control = self._track_controls[layer][ges.TRACK_TYPE_VIDEO]
 
         self.remove(audio_control)
         self.remove(video_control)
@@ -560,9 +561,9 @@ class TimelineControls(gtk.VBox, Loggable):
 
     def getHeightOfLayer(self, track_type, layer):
         if track_type == ges.TRACK_TYPE_VIDEO:
-            return self._track_controls[layer]["video"].getHeight()
+            return self._track_controls[layer][ges.TRACK_TYPE_VIDEO].getHeight()
         else:
-            return self._track_controls[layer]["audio"].getHeight()
+            return self._track_controls[layer][ges.TRACK_TYPE_AUDIO].getHeight()
 
     def getYOfLayer(self, track_type, layer):
         y = 0
@@ -576,11 +577,9 @@ class TimelineControls(gtk.VBox, Loggable):
         return 0
 
     def getHeightOfTrack(self, track_type):
-        map = {ges.TRACK_TYPE_AUDIO: AudioLayerControl,
-               ges.TRACK_TYPE_VIDEO: VideoLayerControl}
         y = 0
         for child in self.get_children():
-            if isinstance(child, map[track_type]):
+            if isinstance(child, self.type_map[track_type]):
                 y += child.getHeight()
                 y += LAYER_SPACING
 



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