Revision: 6455
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6455&view=rev
Author:   jdh2358
Date:     2008-11-26 18:59:58 +0000 (Wed, 26 Nov 2008)

Log Message:
-----------
fixed leave_notify_event for gtk -- need support for other UIs

Modified Paths:
--------------
    trunk/matplotlib/lib/matplotlib/backend_bases.py
    trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py

Modified: trunk/matplotlib/lib/matplotlib/backend_bases.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backend_bases.py    2008-11-26 17:43:09 UTC 
(rev 6454)
+++ trunk/matplotlib/lib/matplotlib/backend_bases.py    2008-11-26 18:59:58 UTC 
(rev 6455)
@@ -744,7 +744,7 @@
     ydata  = None       # y coord of mouse in data coords
 
     # the last event that was triggered before this one
-    _lastevent = None
+    lastevent = None
 
     def __init__(self, name, canvas, x, y,guiEvent=None):
         """
@@ -789,11 +789,10 @@
 
     def _update_enter_leave(self):
         'process the figure/axes enter leave events'
-        if LocationEvent._lastevent is not None:
-            last = LocationEvent._lastevent
+        if LocationEvent.lastevent is not None:
+            last = LocationEvent.lastevent
             if last.canvas!=self.canvas:
                 # process figure enter/leave event
-                last.canvas.callbacks.process('figure_leave_event', last)
                 self.canvas.callbacks.process('figure_enter_event', self)
             if last.inaxes!=self.inaxes:
                 # process axes enter/leave events
@@ -810,7 +809,7 @@
                 self.canvas.callbacks.process('axes_enter_event', self)
 
 
-        LocationEvent._lastevent = self
+        LocationEvent.lastevent = self
 
 
 
@@ -1205,6 +1204,19 @@
                            guiEvent=guiEvent)
         self.callbacks.process(s, event)
 
+    def leave_notify_event(self, guiEvent=None):
+        """
+        Backend derived classes should call this function when leaving
+        canvas
+
+        *guiEvent*
+            the native UI event that generated the mpl event
+
+        """
+        self.callbacks.process('figure_leave_event', LocationEvent.lastevent)
+        LocationEvent.lastevent = None
+
+
     def idle_event(self, guiEvent=None):
         'call when GUI is idle'
         s = 'idle_event'

Modified: trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py     2008-11-26 
17:43:09 UTC (rev 6454)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py     2008-11-26 
18:59:58 UTC (rev 6455)
@@ -170,6 +170,7 @@
         self.connect('key_press_event',      self.key_press_event)
         self.connect('key_release_event',    self.key_release_event)
         self.connect('motion_notify_event',  self.motion_notify_event)
+        self.connect('leave_notify_event',   self.leave_notify_event)
 
         self.set_events(self.__class__.event_mask)
 
@@ -239,6 +240,9 @@
         FigureCanvasBase.motion_notify_event(self, x, y)
         return False  # finish event propagation?
 
+    def leave_notify_event(self, widget, event):
+        FigureCanvasBase.leave_notify_event(self, event)
+
     def _get_key(self, event):
         if event.keyval in self.keyvald:
             key = self.keyvald[event.keyval]


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to