[pitivi] timeline: When dropping clip, avoid create useless layers after the created clip
- From: Thibault Saunier <tsaunier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] timeline: When dropping clip, avoid create useless layers after the created clip
- Date: Thu, 3 Sep 2015 14:14:57 +0000 (UTC)
commit 1ee63c1c2f5c8ceb7f49d153908a4d69eab6f0b0
Author: Thibault Saunier <tsaunier gnome org>
Date: Thu Sep 3 16:11:03 2015 +0200
timeline: When dropping clip, avoid create useless layers after the created clip
When we drop we try twice to create the same layer and we ended up
creating 1 layer extra.
Also when dropping several clips in a 'layer to be created' we ended
up creating one layer per newly created clip.
pitivi/timeline/timeline.py | 18 +++++++++++-------
1 files changed, 11 insertions(+), 7 deletions(-)
---
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index 9b8a4b1..762479a 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -780,7 +780,7 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
for layer, clip in self.__last_clips_on_leave:
if self.__on_separators:
- layer = self.__getDroppedLayer()
+ layer = self.__getDroppedLayer(True)
layer.add_clip(clip)
if zoom_was_fitted:
@@ -1032,23 +1032,27 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
return new_bLayer
- def __getDroppedLayer(self):
+ def __getDroppedLayer(self, dropping):
priority = self._on_layer.props.priority
if self.__on_separators[0] == self._on_layer.ui.after_sep:
priority = self._on_layer.props.priority + 1
self.debug("On separator --> %s" % priority)
- self.createLayer(max(0, priority))
+ if dropping:
+ try:
+ return self.bTimeline.get_layers()[priority]
+ except IndexError:
+ pass
+ self.createLayer(max(0, priority))
return self.bTimeline.get_layers()[priority]
- def dragEnd(self, force=False):
- if (self.draggingElement is not None and self.__got_dragged) or force:
- self.debug("DONE dragging %s" % self.draggingElement)
+ def dragEnd(self, dropping=False):
+ if (self.draggingElement is not None and self.__got_dragged) or dropping:
self._snapEndedCb()
if self.__on_separators:
- priority = self.__getDroppedLayer().get_priority()
+ priority = self.__getDroppedLayer(dropping).get_priority()
self.editing_context.editTo(self.editing_context.new_position, priority)
self.layout.props.width = self._computeTheoricalWidth()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]