[pitivi] timeline: Create one move context when adding a new clip to the timeline



commit 5d3b47d9cd83e486d0a0ca2c593f542965cfa5cd
Author: Thibault Saunier <thibault saunier collabora com>
Date:   Fri May 18 14:25:46 2012 -0400

    timeline: Create one move context when adding a new clip to the timeline
    
    We used to add one on each move:

 pitivi/timeline/timeline.py |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index 9054c9a..992d29f 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -830,12 +830,10 @@ class Timeline(gtk.Table, Loggable, Zoomable):
             # Let some time for TrackObject-s to be created
             if self._temp_objects and not self._creating_tckobjs_sigid:
                 focus = self._temp_objects[0]
-                self._move_context = EditingContext(focus,
-                                            self.timeline,
-                                            ges.EDIT_MODE_NORMAL,
-                                            ges.EDGE_NONE,
-                                            set(self._temp_objects[1:]),
-                                            self.app.settings)
+                if self._move_context is  None:
+                    self._move_context = EditingContext(focus,
+                            self.timeline, ges.EDIT_MODE_NORMAL, ges.EDGE_NONE,
+                            set(self._temp_objects[1:]), self.app.settings)
 
                 self._move_temp_source(x, y)
         return True
@@ -867,13 +865,15 @@ class Timeline(gtk.Table, Loggable, Zoomable):
             self._drag_started = False
             self._factories = []
             if context.targets not in DND_EFFECT_LIST:
+                self.timeline.enable_update(True)
                 self._canvas.drag_unhighlight()
                 self.debug("Need to cleanup %d objects" % len(self._temp_objects))
                 for obj in self._temp_objects:
                     layer = obj.get_layer()
-                    self.log("Cleaning temporary %s on %s" % (obj, layer))
                     layer.remove_object(obj)
                 self._temp_objects = []
+                self._move_context = None
+
             self.debug("Drag cleanup ended")
         self._canvas.handler_unblock_by_func(self._dragMotionCb)
         return False
@@ -889,6 +889,7 @@ class Timeline(gtk.Table, Loggable, Zoomable):
             self._project.emit("selected-changed", set(self.selected))
             if self._move_context is not None:
                 self._move_context.finish()
+                self._move_context = None
             self.app.action_log.commit()
             # The temporary objects and factories that we had created
             # in _dragMotionCb are now kept for good.



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