Revision: 8056
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8056&view=rev
Author:   dsdale
Date:     2009-12-31 12:51:43 +0000 (Thu, 31 Dec 2009)

Log Message:
-----------
workaround for a regression in PyQt4-4.6.{0,1}

Modified Paths:
--------------
    trunk/matplotlib/CHANGELOG
    trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py

Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG  2009-12-28 01:34:06 UTC (rev 8055)
+++ trunk/matplotlib/CHANGELOG  2009-12-31 12:51:43 UTC (rev 8056)
@@ -1,3 +1,5 @@
+2009-12-31 Commit a workaround for a regression in PyQt4-4.6.{0,1} - DSD
+
 2009-12-22 Fix cmap data for gist_earth_r, etc. -JJL
 
 2009-12-20 spines: put spines in data coordinates, add set_bounds()

Modified: trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py     2009-12-28 
01:34:06 UTC (rev 8055)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py     2009-12-31 
12:51:43 UTC (rev 8056)
@@ -206,6 +206,22 @@
             self._idle = True
         if d: QtCore.QTimer.singleShot(0, idle_draw)
 
+
+# XXX Hackish fix: There's a bug in PyQt.  See this thread for details:
+# 
http://old.nabble.com/Qt4-backend:-critical-bug-with-PyQt4-v4.6%2B-td26205716.html
+# Once a release of Qt/PyQt is available without the bug, the version check
+# below can be tightened further to only be applied in the necessary versions.
+if Qt.PYQT_VERSION_STR.startswith('4.6'):
+    class FigureWindow(QtGui.QMainWindow):
+       def __init__(self):
+           super(FigureWindow, self).__init__()
+       def closeEvent(self, event):
+           super(FigureWindow, self).closeEvent(event)
+           self.emit(Qt.SIGNAL('destroyed()'))
+else:
+    FigureWindow = QtGui.QMainWindow
+# /end pyqt hackish bugfix
+
 class FigureManagerQT( FigureManagerBase ):
     """
     Public attributes
@@ -220,7 +236,7 @@
         if DEBUG: print 'FigureManagerQT.%s' % fn_name()
         FigureManagerBase.__init__( self, canvas, num )
         self.canvas = canvas
-        self.window = QtGui.QMainWindow()
+        self.window = FigureWindow()
         self.window.setAttribute(QtCore.Qt.WA_DeleteOnClose)
 
         self.window.setWindowTitle("Figure %d" % num)


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 Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Matplotlib-checkins mailing list
Matplotlib-checkins@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to