Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Remove figure from Gcf when it is closed #1683

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 11 commits into from
Next Next commit
Re-wired signal/slot connections so that the figure in removed from
Gcf when it is closed.

In PR #1498 the attribute WA_DeleteOnClose was no longer set on the
QtMainWindow object in QtFigureManager.  The signal connection that
was being used to remove the figure from Gcf when the window was closed
was tied to the `destroyed()` signal of QtMainWindow, which is no
longer being destroyed.  Thus, gca and gcf would return references
to no-longer visible figures/axes.  _widgetclosed is now called when
MainWindow emits 'closing()'.
  • Loading branch information
Thomas A Caswell committed Jan 18, 2013
commit 121acdcf960ddc4f1c3b81db71f2d50f06bbd3b6
7 changes: 4 additions & 3 deletions 7 lib/matplotlib/backends/backend_qt4.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,9 @@ def __init__( self, canvas, num ):
self.window = MainWindow()
self.window.connect(self.window, QtCore.SIGNAL('closing()'),
canvas.close_event)

self.window.connect( self.window, QtCore.SIGNAL( 'closing()' ),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra whitespace has found its way in here. would you mind removing it? (Is it an automatic editor thing?)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, on my to-do list this weekend is to get my editor set up to highlight pep8 issue.

self._widgetclosed )

self.window.setWindowTitle("Figure %d" % num)
image = os.path.join( matplotlib.rcParams['datapath'],'images','matplotlib.png' )
self.window.setWindowIcon(QtGui.QIcon( image ))
Expand All @@ -403,8 +405,7 @@ def __init__( self, canvas, num ):
self.canvas.setFocusPolicy( QtCore.Qt.StrongFocus )
self.canvas.setFocus()

QtCore.QObject.connect( self.window, QtCore.SIGNAL( 'destroyed()' ),
self._widgetclosed )

self.window._destroying = False

self.toolbar = self._get_toolbar(self.canvas, self.window)
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.