[pitivi] keyframes: emit leave / enter



commit cf466706872e1ba6b8d5bb0e319fbd0ddd18ba42
Author: Mathieu Duponchelle <mathieu duponchelle opencreed com>
Date:   Mon May 4 15:52:07 2015 +0200

    keyframes: emit leave / enter

 pitivi/timeline/elements.py |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/pitivi/timeline/elements.py b/pitivi/timeline/elements.py
index 1a7a239..67d3e4c 100644
--- a/pitivi/timeline/elements.py
+++ b/pitivi/timeline/elements.py
@@ -61,6 +61,10 @@ class KeyframeCurve(FigureCanvas, Loggable):
     __gsignals__ = {
         # Signal our values changed, and a redraw will be needed
         "plot-changed": (GObject.SIGNAL_RUN_LAST, None, ()),
+        # Signal the keyframes or the curve are being hovered
+        "enter": (GObject.SIGNAL_RUN_LAST, None, ()),
+        # Signal the keyframes or the curve are not being hovered anymore
+        "leave": (GObject.SIGNAL_RUN_LAST, None, ()),
     }
 
     def __init__(self, timeline, source):
@@ -114,6 +118,8 @@ class KeyframeCurve(FigureCanvas, Loggable):
         self.__offset = None
         self.__handling_motion = False
 
+        self.__hovered = False
+
         self.connect("motion-notify-event", self.__gtkMotionEventCb)
         self.connect("event", self._eventCb)
 
@@ -199,6 +205,12 @@ class KeyframeCurve(FigureCanvas, Loggable):
         result = self.__line.contains(event)
         if result[0]:
             cursor = DRAG_CURSOR
+            if not self.__hovered:
+                self.emit("enter")
+                self.__hovered = True
+        elif self.__hovered:
+            self.emit("leave")
+            self.__hovered = False
 
         self.__timeline.get_window().set_cursor(
             cursor)


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