[pitivi] Connect 'solo' buttons, make one one layer solo-able
- From: Jean-FranÃois Fortin Tam <jfft src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] Connect 'solo' buttons, make one one layer solo-able
- Date: Sat, 21 Jul 2012 20:00:02 +0000 (UTC)
commit 9d99d7acc8ecaed528e26fb1c1deed8d3bb416ea
Author: Paul Lange <palango gmx de>
Date: Sun Jul 1 13:28:54 2012 +0200
Connect 'solo' buttons, make one one layer solo-able
Also rename track_controls to layer_controls
pitivi/timeline/layer.py | 28 ++++++++++++++++++++--------
pitivi/timeline/timeline.py | 28 +++++++++++++++++++---------
2 files changed, 39 insertions(+), 17 deletions(-)
---
diff --git a/pitivi/timeline/layer.py b/pitivi/timeline/layer.py
index 6a6f5bb..0b425f5 100644
--- a/pitivi/timeline/layer.py
+++ b/pitivi/timeline/layer.py
@@ -69,13 +69,14 @@ class BaseLayerControl(gtk.Table, Loggable):
name_entry.props.sensitive = False
# 'Solo' toggle button
- solo_button = gtk.ToggleButton()
- solo_button.set_tooltip_text(_("Only show this layer\n\nOther layers won't" +
+ self.solo_button = gtk.ToggleButton()
+ self.solo_button.set_tooltip_text(_("Only show this layer\n\nOther layers won't" +
"be visible as long a this is enabled"))
solo_image = gtk.Image()
solo_image.set_from_icon_name("avatar-default-symbolic", gtk.ICON_SIZE_MENU)
- solo_button.add(solo_image)
- solo_button.props.sensitive = False
+ self.solo_button.add(solo_image)
+ self.solo_button.connect("toggled", self._soloToggledCb)
+ self.solo_button.props.sensitive = False
# CheckButton
visible_option = gtk.CheckButton()
@@ -95,7 +96,7 @@ class BaseLayerControl(gtk.Table, Loggable):
# Upper bar
upper = gtk.HBox()
upper.pack_start(name_entry, True, True)
- upper.pack_start(solo_button, False, False)
+ upper.pack_start(self.solo_button, False, False)
upper.pack_start(visible_option, False, False)
upper.pack_start(del_button, False, False)
@@ -120,9 +121,6 @@ class BaseLayerControl(gtk.Table, Loggable):
else:
button.set_tooltip_text(_("Make layer visible"))
- def getHeight(self):
- return self.get_allocation().height
-
def _focusChangeCb(self, widget, direction, sensitive_actions):
self._app.gui.setActionsSensitive(sensitive_actions)
@@ -130,6 +128,20 @@ class BaseLayerControl(gtk.Table, Loggable):
timeline = self._layer.get_timeline()
timeline.remove_layer(self._layer)
+ def _soloToggledCb(self, button):
+ if button.get_active():
+ # Disable all other layers
+ self._app.gui.timeline_ui._controls.soloLayer(self._layer)
+ else:
+ # Enable all layers
+ self._app.gui.timeline_ui._controls.soloLayer(None)
+
+ def getHeight(self):
+ return self.get_allocation().height
+
+ def setSoloState(self, state):
+ self.solo_button.set_active(state)
+
class VideoLayerControl(BaseLayerControl):
"""
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index c82926c..22fdd21 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -472,13 +472,15 @@ class TimelineCanvas(goocanvas.Canvas, Zoomable, Loggable):
class TimelineControls(gtk.VBox, Loggable):
- """Contains the timeline track names."""
+ """
+ Holds and manages the LayerControlWidgets
+ """
def __init__(self, instance):
gtk.VBox.__init__(self)
Loggable.__init__(self)
self.app = instance
- self._track_controls = {}
+ self._layer_controls = {}
self._timeline = None
self.set_spacing(LAYER_SPACING)
self.type_map = {ges.TRACK_TYPE_AUDIO: AudioLayerControl,
@@ -497,7 +499,7 @@ class TimelineControls(gtk.VBox, Loggable):
self.debug("Setting timeline %s", timeline)
# remove old layer controls
- for layer in self._track_controls.copy():
+ for layer in self._layer_controls.copy():
self._layerRemovedCb(None, layer)
if timeline:
@@ -522,7 +524,7 @@ class TimelineControls(gtk.VBox, Loggable):
map = {ges.TRACK_TYPE_AUDIO: audio_control,
ges.TRACK_TYPE_VIDEO: video_control}
- self._track_controls[layer] = map
+ self._layer_controls[layer] = map
self.pack_start(video_control, False, False)
self.pack_start(audio_control, False, False)
@@ -544,19 +546,19 @@ class TimelineControls(gtk.VBox, Loggable):
j += 1
def _layerRemovedCb(self, timeline, layer):
- audio_control = self._track_controls[layer][ges.TRACK_TYPE_AUDIO]
- video_control = self._track_controls[layer][ges.TRACK_TYPE_VIDEO]
+ audio_control = self._layer_controls[layer][ges.TRACK_TYPE_AUDIO]
+ video_control = self._layer_controls[layer][ges.TRACK_TYPE_VIDEO]
self.remove(audio_control)
self.remove(video_control)
- del self._track_controls[layer]
+ del self._layer_controls[layer]
def getHeightOfLayer(self, track_type, layer):
if track_type == ges.TRACK_TYPE_VIDEO:
- return self._track_controls[layer][ges.TRACK_TYPE_VIDEO].getHeight()
+ return self._layer_controls[layer][ges.TRACK_TYPE_VIDEO].getHeight()
else:
- return self._track_controls[layer][ges.TRACK_TYPE_AUDIO].getHeight()
+ return self._layer_controls[layer][ges.TRACK_TYPE_AUDIO].getHeight()
def getYOfLayer(self, track_type, layer):
y = 0
@@ -597,6 +599,14 @@ class TimelineControls(gtk.VBox, Loggable):
return 0
+ def soloLayer(self, layer):
+ """
+ Enable this layer and disable all others
+ """
+ for key, controls in self._layer_controls.iteritems():
+ controls[ges.TRACK_TYPE_VIDEO].setSoloState(key == layer)
+ controls[ges.TRACK_TYPE_AUDIO].setSoloState(key == layer)
+
class InfoStub(gtk.HBox, Loggable):
"""
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]