Skip to content

make SubplotTool into a modal dialog, keep ref to SubplotTool #9899

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

Merged
merged 1 commit into from
Dec 1, 2017
Merged

make SubplotTool into a modal dialog, keep ref to SubplotTool #9899

merged 1 commit into from
Dec 1, 2017

Conversation

mattip
Copy link
Contributor

@mattip mattip commented Dec 1, 2017

In using matplotlib (after PR #9356) on PyPy, I ran into an issue that the TkAGG SubplotTool python object was being collected by the PyPy garbage collector (GC). It turns out that the SubplotTool holds circular references, and these are resolved in the CPython GC much much later than in PyPy. I also noticed that the SubPlotTool on TkAGG is not a modal window, I can open many at the same time.

PR Summary

This pull request solves both problems: holds a reference to the SubplotTool and makes the dialog into a modal dialog.

Here is code that provides a basis for a manual test, I am not sure how to test the modality of a dialog box via a unittest:

import matplotlib
matplotlib.use('TkAgg')
from matplotlib import pylab
fig = pylab.plot(range(10))
pylab.show()
# press the subplot button in the toolbar
# try to press the button again, the SubplotTool dialog should hold focus
# make sure the SubplotTool is functioning, that the sliders affect the main window

PR Checklist

  • Has Pytest style unit tests
  • Code is PEP 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@tacaswell tacaswell added this to the v2.2 milestone Dec 1, 2017
Copy link
Member

@jklymak jklymak left a comment

Choose a reason for hiding this comment

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

This works for me (and I can confirm the original bug).

@jklymak jklymak merged commit 1293916 into matplotlib:master Dec 1, 2017
@mattip mattip deleted the tkagg-modal-subplot branch December 2, 2017 15:42
@QuLogic QuLogic modified the milestones: needs sorting, v2.2.0 Feb 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants