|
From: <ry...@us...> - 2010-04-16 19:01:01
|
Revision: 8237
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8237&view=rev
Author: ryanmay
Date: 2010-04-16 19:00:55 +0000 (Fri, 16 Apr 2010)
Log Message:
-----------
Add the appropriate code to each of the backends to call close_event() so that the events are properly dispatched.
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py
trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py
trunk/matplotlib/lib/matplotlib/backends/backend_tkagg.py
trunk/matplotlib/lib/matplotlib/backends/backend_wx.py
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py 2010-04-16 18:37:44 UTC (rev 8236)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py 2010-04-16 19:00:55 UTC (rev 8237)
@@ -186,6 +186,7 @@
def destroy(self):
#gtk.DrawingArea.destroy(self)
+ self.close_event()
gobject.source_remove(self._idle_event_id)
if self._idle_draw_id != 0:
gobject.source_remove(self._idle_draw_id)
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py 2010-04-16 18:37:44 UTC (rev 8236)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py 2010-04-16 19:00:55 UTC (rev 8237)
@@ -104,6 +104,9 @@
w,h = self.get_width_height()
self.resize( w, h )
+ QtCore.QObject.connect(self, QtCore.SIGNAL('destroyed()'),
+ self.close_event)
+
def __timerEvent(self, event):
# hide until we can test and fix
self.mpl_idle_event(event)
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_tkagg.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_tkagg.py 2010-04-16 18:37:44 UTC (rev 8236)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_tkagg.py 2010-04-16 19:00:55 UTC (rev 8237)
@@ -177,6 +177,13 @@
root = self._tkcanvas.winfo_toplevel()
root.bind("<MouseWheel>", self.scroll_event_windows)
+ # Can't get destroy events by binding ot _tkcanvas. Therefore, bind
+ # to the window and filter.
+ def filter_destroy(evt):
+ if evt.widget is self._tkcanvas:
+ self.close_event()
+ root.bind("<Destroy>", filter_destroy)
+
self._master = master
self._tkcanvas.focus_set()
@@ -765,4 +772,3 @@
FigureManager = FigureManagerTkAgg
-
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_wx.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2010-04-16 18:37:44 UTC (rev 8236)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2010-04-16 19:00:55 UTC (rev 8237)
@@ -1476,6 +1476,7 @@
def _onClose(self, evt):
DEBUG_MSG("onClose()", 1, self)
+ self.canvas.close_event()
self.canvas.stop_event_loop()
Gcf.destroy(self.num)
#self.Destroy()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|