[pitivi] timeline: Reuse logic moved to Timeline.__update_layer
- From: Alexandru Băluț <alexbalut src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] timeline: Reuse logic moved to Timeline.__update_layer
- Date: Sat, 16 Apr 2016 14:10:01 +0000 (UTC)
commit 85cc94f73bc954aef9949336b8775a36902cd4d7
Author: Alexandru Băluț <alexandru balut gmail com>
Date: Thu Apr 14 16:23:18 2016 +0200
timeline: Reuse logic moved to Timeline.__update_layer
Differential Revision: https://phabricator.freedesktop.org/D907
pitivi/timeline/timeline.py | 45 +++++++++++++++++++-----------------------
1 files changed, 20 insertions(+), 25 deletions(-)
---
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index e9cd61e..f309e05 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -932,22 +932,16 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
self.ges_timeline.remove_layer(layer.ges_layer)
def __layerPriorityChangedCb(self, ges_layer, pspec):
- self.__resetLayersByPriority()
+ self.__update_layers()
- def __resetLayersByPriority(self, reset=False):
+ def __update_layers(self, reset=False):
self._layers.sort(key=lambda layer: layer.ges_layer.props.priority)
self.debug("Reseting layers priorities")
for i, layer in enumerate(self._layers):
+ ges_layer = layer.ges_layer
if reset:
- layer.ges_layer.props.priority = i
-
- self.__layers_vbox.child_set_property(layer.get_parent(),
- "position",
- layer.ges_layer.props.priority)
-
- self.__layers_controls_vbox.child_set_property(layer.ges_layer.control_ui,
- "position",
- layer.ges_layer.props.priority)
+ ges_layer.props.priority = i
+ self.__update_layer(ges_layer)
def _removeLayer(self, ges_layer):
self.info("Removing layer: %s", ges_layer.props.priority)
@@ -960,7 +954,7 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
ges_layer.ui = None
ges_layer.control_ui = None
- self.__resetLayersByPriority(True)
+ self.__update_layers(True)
def _layerRemovedCb(self, unused_ges_timeline, ges_layer):
self._removeLayer(ges_layer)
@@ -1112,23 +1106,24 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
if ges_layer.get_priority() >= priority:
ges_layer.props.priority += 1
- self.__layers_vbox.child_set_property(ges_layer.ui.get_parent(),
- "position",
- ges_layer.props.priority)
+ self.__update_layer(ges_layer)
- self.__layers_controls_vbox.child_set_property(ges_layer.control_ui,
- "position",
- ges_layer.props.priority)
+ self.__update_layer(new_ges_layer)
- self.__layers_vbox.child_set_property(new_ges_layer.ui.get_parent(),
- "position",
- new_ges_layer.props.priority)
+ return new_ges_layer
- self.__layers_controls_vbox.child_set_property(new_ges_layer.control_ui,
- "position",
- new_ges_layer.props.priority)
+ def __update_layer(self, ges_layer):
+ """
+ Update the position child prop of the layer and layer control widgets.
+ """
+ priority = ges_layer.props.priority
- return new_ges_layer
+ layer_box = ges_layer.ui.get_parent()
+ self.__layers_vbox.child_set_property(layer_box, "position", priority)
+
+ self.__layers_controls_vbox.child_set_property(ges_layer.control_ui,
+ "position",
+ priority)
def __getDroppedLayer(self):
"""
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]