[pitivi] Correctly show audio and video controls
- From: Jean-FranÃois Fortin Tam <jfft src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] Correctly show audio and video controls
- Date: Sat, 21 Jul 2012 19:57:31 +0000 (UTC)
commit 7adb25dd876e6fde7cee971ccb7333173d3e43ef
Author: Paul Lange <palango gmx de>
Date: Wed May 9 18:48:12 2012 -0500
Correctly show audio and video controls
pitivi/timeline/layercontrols.py | 44 ++-----------------------------------
pitivi/timeline/timeline.py | 12 ++++++++-
2 files changed, 13 insertions(+), 43 deletions(-)
---
diff --git a/pitivi/timeline/layercontrols.py b/pitivi/timeline/layercontrols.py
index 556d956..39a14b4 100644
--- a/pitivi/timeline/layercontrols.py
+++ b/pitivi/timeline/layercontrols.py
@@ -39,7 +39,7 @@ class BaseLayerControl(gtk.Table, Loggable):
__gtype_name__ = 'LayerControl'
- def __init__(self, track, layer_type):
+ def __init__(self, layer_type):
gtk.Table.__init__(self, rows=2, columns=2)
Loggable.__init__(self)
@@ -83,14 +83,7 @@ class BaseLayerControl(gtk.Table, Loggable):
self.attach(upper, 1, 2, 0, 1)
self.attach(self.lower_hbox, 1, 2, 1, 2)
- # The value below is arbitrarily chosen so the text appears
- # centered vertically when the represented track has a single layer.
- #self.set_padding(0, LAYER_SPACING * 2)
self.show_all()
- self._track = None
- self._timeline = None
- self.setTrack(track)
- self._setSize(layers_count=1)
def _foldingChangedCb(self, button, state):
if state:
@@ -98,45 +91,14 @@ class BaseLayerControl(gtk.Table, Loggable):
else:
self.lower_hbox.hide()
- def getTrack(self):
- return self._track
-
- def setTrack(self, track):
- if self._track:
- self._timeline.disconnect_by_func(self._layerAddedCb)
- self._timeline.disconnect_by_func(self._layerRemovedCb)
-
- self._track = track
- if track:
- self._timeline = track.get_timeline()
- self._timeline.connect("layer-added", self._layerAddedCb)
- self._timeline.connect("layer-removed", self._layerRemovedCb)
- else:
- self._timeline = None
-
- track = property(getTrack, setTrack, None, "The (GESTrack property")
-
- def _layerAddedCb(self, timeline, unused_layer):
- max_priority = len(timeline.get_layers())
- self._setSize(max_priority)
-
- def _layerRemovedCb(self, timeline, unused_layer):
- max_priority = len(timeline.get_layers())
- self._setSize(max_priority)
-
- def _setSize(self, layers_count):
- assert layers_count >= 1
- height = layers_count * (LAYER_HEIGHT_EXPANDED + LAYER_SPACING)
- self.set_size_request(-1, height)
-
class VideoLayerControl(BaseLayerControl):
"""
Layer control class for video layers
"""
- def __init__(self, track):
- BaseLayerControl.__init__(self, track, "video")
+ def __init__(self):
+ BaseLayerControl.__init__(self, "video")
opacity = gtk.Label(_("Opacity:"))
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index f25b652..99d9c0f 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -44,7 +44,7 @@ from pitivi.settings import GlobalSettings
from curve import KW_LABEL_Y_OVERFLOW
from track import TRACK_CONTROL_WIDTH, Track, TrackObject
-from layercontrols import VideoLayerControl
+from layercontrols import VideoLayerControl, AudioLayerControl
from pitivi.utils.timeline import EditingContext, SELECT, Zoomable
from pitivi.dialogs.depsmanager import DepsManager
@@ -509,7 +509,7 @@ class TimelineControls(gtk.VBox, Loggable):
timeline = property(getTimeline, setTimeline, None, "The timeline property")
def _trackAddedCb(self, timeline, track):
- track_control = VideoLayerControl(track)
+ track_control = self._getControlForTrack(track)
self._tracks_controls.append(track_control)
self.pack_start(track_control, False, False)
track_control.show()
@@ -520,6 +520,14 @@ class TimelineControls(gtk.VBox, Loggable):
del self._tracks_controls[position]
self.remove(track)
+ def _getControlForTrack(self, track):
+ if track.props.track_type == ges.TRACK_TYPE_AUDIO:
+ return AudioLayerControl()
+ elif track.props.track_type == ges.TRACK_TYPE_VIDEO:
+ return VideoLayerControl()
+ elif track.props.track_type == ges.TRACK_TYPE_TEXT:
+ return None
+
class InfoStub(gtk.HBox, Loggable):
"""
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]