[pitivi] Reimplement layer removal in the Clutter timeline
- From: Jean-François Fortin Tam <jfft src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] Reimplement layer removal in the Clutter timeline
- Date: Wed, 24 Apr 2013 18:02:21 +0000 (UTC)
commit d5d4560aac56561621e5432f0d4596c01a9a2711
Author: Mathieu Duponchelle <mathieu duponchelle epitech eu>
Date: Wed Apr 17 04:47:42 2013 +0200
Reimplement layer removal in the Clutter timeline
pitivi/timeline/controls.py | 9 +++++++++
pitivi/timeline/timeline.py | 23 +++++++++++------------
2 files changed, 20 insertions(+), 12 deletions(-)
---
diff --git a/pitivi/timeline/controls.py b/pitivi/timeline/controls.py
index 33468a6..b59b036 100644
--- a/pitivi/timeline/controls.py
+++ b/pitivi/timeline/controls.py
@@ -147,3 +147,12 @@ class ControlContainer(Clutter.ScrollActor):
self.addTrackControl(layer, False)
self.addTrackControl(layer, True)
self._reorderLayerActors()
+
+ def removeLayerControl(self, layer):
+ for control in self.controlActors:
+ if control.layer == layer:
+ self.remove_child(control)
+ self.trackControls.remove(control.widget)
+
+ self.controlActors = [elem for elem in self.controlActors if elem.layer != layer]
+ self._reorderLayerActors()
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index bcb8148..8d0bddf 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -196,6 +196,7 @@ class TimelineStage(Clutter.ScrollActor, Zoomable):
def _updatePlayHead(self):
height = len(self.bTimeline.get_layers()) * (EXPANDED_SIZE + SPACING) * 2
self.playhead.set_size(PLAYHEAD_WIDTH, height)
+ self.playhead.props.x = self.nsToPixel(self.lastPosition)
def _createPlayhead(self):
self.playhead = Clutter.Actor()
@@ -276,8 +277,9 @@ class TimelineStage(Clutter.ScrollActor, Zoomable):
self.save_easing_state()
self.set_easing_duration(0)
self.props.width = self.nsToPixel(self.bTimeline.get_duration()) + 250
+ self.props.height = (len(self.bTimeline.get_layers()) + 1) * (EXPANDED_SIZE + SPACING) * 2 + SPACING
self.restore_easing_state()
-
+ self._container.vadj.props.upper = self.props.height
self._container.updateHScrollAdjustments()
def _redraw(self):
@@ -286,22 +288,18 @@ class TimelineStage(Clutter.ScrollActor, Zoomable):
self.save_easing_state()
for element in self.elements:
self._setElementX(element)
- self.restore_easing_state()
-
- self.playhead.props.x = self.nsToPixel(self.lastPosition)
-
- def _add_layer(self, layer):
- for element in self.elements:
self._setElementY(element)
-
- self.save_easing_state()
- self.props.height = (len(self.bTimeline.get_layers()) + 1) * (EXPANDED_SIZE + SPACING) * 2 + SPACING
self.restore_easing_state()
- self._container.vadj.props.upper = self.props.height
+ self._updatePlayHead()
+ def _remove_layer(self, layer):
+ self._redraw()
+ self._container.controls.removeLayerControl(layer)
+
+ def _add_layer(self, layer):
+ self._redraw()
self._container.controls.addLayerControl(layer)
- self._updatePlayHead()
# Interface overrides
@@ -346,6 +344,7 @@ class TimelineStage(Clutter.ScrollActor, Zoomable):
def _layerRemovedCb(self, timeline, layer):
# FIXME : really remove layer ^^
+ self._remove_layer(layer)
self._updatePlayHead()
def _trackAddedCb(self, timeline, track):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]