[pitivi] elements: Fix removing a keyframe



commit 30859c4262196b32f0dc30b592c7e5bfc12ffa29
Author: Fabian Orccon <fabian orccon pucp pe>
Date:   Mon Apr 18 20:15:07 2016 +0000

    elements: Fix removing a keyframe
    
    When double-clicking on a keyframe, it was not removed.
    
    Differential Revision: https://phabricator.freedesktop.org/D920

 pitivi/timeline/elements.py |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/pitivi/timeline/elements.py b/pitivi/timeline/elements.py
index b786e64..b7f0c3e 100644
--- a/pitivi/timeline/elements.py
+++ b/pitivi/timeline/elements.py
@@ -151,6 +151,9 @@ class KeyframeCurve(FigureCanvas, Loggable):
 
         self.__hovered = False
 
+        # Whether a keyframe has just been removed.
+        self.__keyframe_removed = False
+
         self.connect("motion-notify-event", self.__gtkMotionEventCb)
         self.connect("event", self._eventCb)
         self.connect("notify::height-request", self.__heightRequestCb)
@@ -245,6 +248,8 @@ class KeyframeCurve(FigureCanvas, Loggable):
                     # It's an edge keyframe. These should not be removed.
                     return
                 # A keyframe has been double-clicked, remove it.
+                self.debug("Removing keyframe at timestamp %lf", offset)
+                self.__keyframe_removed = True
                 self.__source.unset(offset)
             else:
                 # Remember the clicked frame for drag&drop.
@@ -322,7 +327,11 @@ class KeyframeCurve(FigureCanvas, Loggable):
             self.__dragged = False
         else:
             assert event.guiEvent.type == Gdk.EventType.BUTTON_RELEASE
-            self.__maybeCreateKeyframe(event)
+            if not self.__keyframe_removed:
+                self.__maybeCreateKeyframe(event)
+            else:
+                self.__keyframe_removed = False
+
 
     def __setTooltip(self, event):
         if event.xdata:


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