From: <ds...@us...> - 2007-09-24 12:56:53
|
Revision: 3879 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3879&view=rev Author: dsdale Date: 2007-09-24 05:56:38 -0700 (Mon, 24 Sep 2007) Log Message: ----------- fix backend_qt* bug with multiple plot windows and show() Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/backends/backend_qt.py trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py Modified: trunk/matplotlib/lib/matplotlib/backends/backend_qt.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_qt.py 2007-09-23 13:50:01 UTC (rev 3878) +++ trunk/matplotlib/lib/matplotlib/backends/backend_qt.py 2007-09-24 12:56:38 UTC (rev 3879) @@ -46,11 +46,11 @@ qApp = qt.QApplication( [" "] ) qt.QObject.connect( qApp, qt.SIGNAL( "lastWindowClosed()" ), qApp, qt.SLOT( "quit()" ) ) - else: - # someone else aready created the qApp and - # we let them handle the event-loop control. - show._needmain = False + #remember that matplotlib created the qApp - will be used by show() + _create_qApp.qAppCreatedHere = True +_create_qApp.qAppCreatedHere = False + def show(): """ Show all the figures and enter the qt main loop @@ -65,13 +65,10 @@ if figManager != None: figManager.canvas.draw() - if ( show._needmain ): - qt.qApp.exec_loop() - show._needmain = False + if _create_qApp.qAppCreatedHere: + qt.qApp.exec_loop() -show._needmain = True - def new_figure_manager( num, *args, **kwargs ): """ Create a new figure manager instance Modified: trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py 2007-09-23 13:50:01 UTC (rev 3878) +++ trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py 2007-09-24 12:56:38 UTC (rev 3879) @@ -47,10 +47,10 @@ QtCore.QObject.connect( qApp, QtCore.SIGNAL( "lastWindowClosed()" ), qApp, QtCore.SLOT( "quit()" ) ) else: - # someone else aready created the qApp and - # we let them handle the event-loop control. - show._needmain = False + _create_qApp.qAppCreatedHere = True +_create_qApp.qAppCreatedHere = False + def show(): """ Show all the figures and enter the qt main loop @@ -65,13 +65,10 @@ if figManager != None: figManager.canvas.draw() - if ( show._needmain ): - qApp.exec_() - show._needmain = False + if _create_qApp.qAppCreatedHere: + QtGui.qApp.exec_() -show._needmain = True - def new_figure_manager( num, *args, **kwargs ): """ Create a new figure manager instance This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |