[pitivi] Put multiple new clips in sequence on the same layer



commit 6e212035ff3403219e04f2ffa799cb6f70693255
Author: Odin Hørthe Omdal <odinho opera com>
Date:   Sat Sep 21 13:44:07 2013 +0200

    Put multiple new clips in sequence on the same layer
    
    Earlier the code would put all clips on top of each other and give each
    clip its own layer. This is unexpected and not very helpful.

 pitivi/timeline/timeline.py |   34 +++++++++++++++++++---------------
 1 files changed, 19 insertions(+), 15 deletions(-)
---
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index d38d676..4bbf8eb 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -281,36 +281,40 @@ class TimelineStage(Clutter.ScrollActor, Zoomable):
     This is called at drag-drop
     """
     def convertGhostClips(self):
+        placement = 0
+        layer = None
+
         for ghostCouple in self.ghostClips:
             ghostclip = ghostCouple[0]
             if not ghostclip:
                 ghostclip = ghostCouple[1]
 
-            layer = None
-            target = None
-
-            if ghostclip.shouldCreateLayer:
-                layer = self.insertLayer(ghostclip)
-                target = layer
-            else:
-                for layer in self.bTimeline.get_layers():
-                    if layer.get_priority() == ghostclip.priority:
-                        target = layer
-                        break
-
-            if target is None:
-                layer = self.bTimeline.append_layer()
+            if layer is None:
+                target = None
+                if ghostclip.shouldCreateLayer:
+                    layer = self.insertLayer(ghostclip)
+                    target = layer
+                else:
+                    for layer in self.bTimeline.get_layers():
+                        if layer.get_priority() == ghostclip.priority:
+                            target = layer
+                            break
+                if target is None:
+                    layer = self.bTimeline.append_layer()
 
             if ghostclip.asset.is_image():
                 clip_duration = self._settings.imageClipLength * Gst.SECOND / 1000.0
             else:
                 clip_duration = ghostclip.asset.get_duration()
 
+            if not placement:
+                placement = Zoomable.pixelToNs(ghostclip.props.x)
             layer.add_asset(ghostclip.asset,
-                            Zoomable.pixelToNs(ghostclip.props.x),
+                            placement,
                             0,
                             clip_duration,
                             ghostclip.asset.get_supported_formats())
+            placement += clip_duration
         self.bTimeline.commit()
 
     """


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]