Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Update backend_nbagg for removal of Gcf._activeQue.
Looks like nbagg was (ab)using _activeQue to have "pyplot-managed
figures that can never be gcf()" (not really sure why? this was here
ever since nbagg was first merged in).  Now that _activeQue has been
merged into figs this is no longer possible, but I *guess* the patch is
the closest in semantics?
  • Loading branch information
anntzer committed Dec 16, 2019
commit 2692cf8a3ce42e340d468fbdfb1cd435177bb0a5
10 changes: 5 additions & 5 deletions lib/matplotlib/backends/backend_nbagg.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def connection_info():
for manager in Gcf.get_all_fig_managers()
]
if not is_interactive():
result.append('Figures pending show: {}'.format(len(Gcf._activeQue)))
result.append(f'Figures pending show: {len(Gcf.figs)}')
return '\n'.join(result)


Expand Down Expand Up @@ -259,12 +259,12 @@ def show(*args, block=None, **kwargs):
for manager in managers:
manager.show()

# plt.figure adds an event which puts the figure in focus
# in the activeQue. Disable this behaviour, as it results in
# plt.figure adds an event which makes the figure in focus the
# active one. Disable this behaviour, as it results in
# figures being put as the active figure after they have been
# shown, even in non-interactive mode.
if hasattr(manager, '_cidgcf'):
manager.canvas.mpl_disconnect(manager._cidgcf)

if not interactive and manager in Gcf._activeQue:
Gcf._activeQue.remove(manager)
if not interactive:
Gcf.figs.pop(manager.num, None)