Revision: 6468
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6468&view=rev
Author: jdh2358
Date: 2008-12-02 15:40:44 +0000 (Tue, 02 Dec 2008)
Log Message:
-----------
added gregor's wx enter/leave patch - fixed figure_enter problem
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/backend_bases.py
trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py
trunk/matplotlib/lib/matplotlib/backends/backend_wx.py
Modified: trunk/matplotlib/lib/matplotlib/backend_bases.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backend_bases.py 2008-12-02 15:32:07 UTC
(rev 6467)
+++ trunk/matplotlib/lib/matplotlib/backend_bases.py 2008-12-02 15:40:44 UTC
(rev 6468)
@@ -791,9 +791,6 @@
'process the figure/axes enter leave events'
if LocationEvent.lastevent is not None:
last = LocationEvent.lastevent
- if last.canvas!=self.canvas:
- # process figure enter/leave event
- self.canvas.callbacks.process('figure_enter_event', self)
if last.inaxes!=self.inaxes:
# process axes enter/leave events
if last.inaxes is not None:
@@ -803,8 +800,6 @@
else:
# process a figure enter event
- self.canvas.callbacks.process('figure_enter_event', self)
- # process an axes enter event if we are over an axes
if self.inaxes is not None:
self.canvas.callbacks.process('axes_enter_event', self)
@@ -952,8 +947,6 @@
'pick_event',
'idle_event',
'figure_enter_event',
- # todo: we only process this when a mouse enters a different
- # figure -- we need to connect to the GUI leavel event
'figure_leave_event',
'axes_enter_event',
'axes_leave_event'
@@ -1216,7 +1209,18 @@
self.callbacks.process('figure_leave_event', LocationEvent.lastevent)
LocationEvent.lastevent = None
+ def enter_notify_event(self, guiEvent=None):
+ """
+ Backend derived classes should call this function when entering
+ canvas
+ *guiEvent*
+ the native UI event that generated the mpl event
+
+ """
+ event = Event('figure_enter_event', self, guiEvent)
+ self.callbacks.process('figure_enter_event', event)
+
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-12-02
15:32:07 UTC (rev 6467)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py 2008-12-02
15:40:44 UTC (rev 6468)
@@ -147,6 +147,7 @@
gdk.EXPOSURE_MASK |
gdk.KEY_PRESS_MASK |
gdk.KEY_RELEASE_MASK |
+ gdk.ENTER_NOTIFY_MASK |
gdk.LEAVE_NOTIFY_MASK |
gdk.POINTER_MOTION_MASK |
gdk.POINTER_MOTION_HINT_MASK)
@@ -171,6 +172,7 @@
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.connect('enter_notify_event', self.enter_notify_event)
self.set_events(self.__class__.event_mask)
@@ -243,6 +245,9 @@
def leave_notify_event(self, widget, event):
FigureCanvasBase.leave_notify_event(self, event)
+ def enter_notify_event(self, widget, event):
+ FigureCanvasBase.enter_notify_event(self, event)
+
def _get_key(self, event):
if event.keyval in self.keyvald:
key = self.keyvald[event.keyval]
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_wx.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2008-12-02
15:32:07 UTC (rev 6467)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2008-12-02
15:40:44 UTC (rev 6468)
@@ -1263,10 +1263,10 @@
FigureCanvasBase.motion_notify_event(self, x, y, guiEvent=evt)
def _onLeave(self, evt):
- """Mouse has left the window; fake a motion event."""
+ """Mouse has left the window."""
evt.Skip()
- FigureCanvasBase.motion_notify_event(self, -1, -1, guiEvent=evt)
+ FigureCanvasBase.leave_notify_event(self, guiEvent = evt)
########################################################################
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