[pitivi] timeline: Fix stacktrace when clicking handlebar



commit 3b6ecb1a4d72fd235350522a26929f77095d08e3
Author: Alexandru Băluț <alexandru balut gmail com>
Date:   Mon Jan 6 09:40:12 2014 +0100

    timeline: Fix stacktrace when clicking handlebar
    
    Without this, a stacktrace appears if you click a handlebar and then you
    move the mouse away, because the finish method expects that editTo has been
    called but it's not called if the mouse did not move.

 pitivi/utils/timeline.py |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/pitivi/utils/timeline.py b/pitivi/utils/timeline.py
index 22c1248..915a016 100644
--- a/pitivi/utils/timeline.py
+++ b/pitivi/utils/timeline.py
@@ -253,6 +253,7 @@ class EditingContext(Signallable):
             self.old_position += self.focus.get_duration()
 
         self.old_priority = self.focus.get_priority()
+        self.new_position = None
 
         self.timeline = timeline
         self.action_log = action_log
@@ -264,13 +265,13 @@ class EditingContext(Signallable):
 
     def finish(self):
         """Clean up timeline for normal editing"""
-
-        action = ClipEdited(self.focus, self.old_priority, self.new_priority, self.mode, self.edge,
-                            self.old_position, self.new_position)
-
-        self.action_log.push(action)
-        self.action_log.commit()
-        self.timeline.commit()
+        if self.new_position is not None and self.new_priority is not None:
+            # The mouse cursor did move.
+            action = ClipEdited(self.focus, self.old_priority, self.new_priority, self.mode, self.edge,
+                                self.old_position, self.new_position)
+            self.action_log.push(action)
+            self.action_log.commit()
+            self.timeline.commit()
         self.emit("clip-trim-finished")
 
     def setMode(self, mode):


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