|
From: <ef...@us...> - 2010-06-04 22:06:13
|
Revision: 8380
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8380&view=rev
Author: efiring
Date: 2010-06-04 22:06:07 +0000 (Fri, 04 Jun 2010)
Log Message:
-----------
[2901582] Don't fail if the previous LocationEvent was in a canvas that no longer exists.
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/backend_bases.py
Modified: trunk/matplotlib/lib/matplotlib/backend_bases.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backend_bases.py 2010-06-04 20:57:33 UTC (rev 8379)
+++ trunk/matplotlib/lib/matplotlib/backend_bases.py 2010-06-04 22:06:07 UTC (rev 8380)
@@ -1069,12 +1069,13 @@
class LocationEvent(Event):
"""
- A event that has a screen location
+ An event that has a screen location
The following additional attributes are defined and shown with
- their default values
+ their default values.
- In addition to the :class:`Event` attributes, the following event attributes are defined:
+ In addition to the :class:`Event` attributes, the following
+ event attributes are defined:
*x*
x position - pixels from left of canvas
@@ -1148,8 +1149,16 @@
last = LocationEvent.lastevent
if last.inaxes!=self.inaxes:
# process axes enter/leave events
- if last.inaxes is not None:
- last.canvas.callbacks.process('axes_leave_event', last)
+ try:
+ if last.inaxes is not None:
+ last.canvas.callbacks.process('axes_leave_event', last)
+ except:
+ pass
+ # See ticket 2901582.
+ # I think this is a valid exception to the rule
+ # against catching all exceptions; if anything goes
+ # wrong, we simply want to move on and process the
+ # current event.
if self.inaxes is not None:
self.canvas.callbacks.process('axes_enter_event', self)
@@ -1158,12 +1167,12 @@
if self.inaxes is not None:
self.canvas.callbacks.process('axes_enter_event', self)
-
LocationEvent.lastevent = self
+
class MouseEvent(LocationEvent):
"""
A mouse event ('button_press_event', 'button_release_event', 'scroll_event',
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|