8000 Merge pull request #4921 from thisch/quit_all · matplotlib/matplotlib@a56d588 · GitHub
[go: up one dir, main page]

Skip to content

Commit a56d588

Browse files
committed
Merge pull request #4921 from thisch/quit_all
Add a quit_all key to the default keymap
2 parents c95e64d + f25ee91 commit a56d588

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

doc/users/navigation_toolbar.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ Zoom-to-rect **o**
9595
Save **ctrl** + **s**
9696
Toggle fullscreen **ctrl** + **f**
9797
Close plot **ctrl** + **w**
98-
Constrain pan/zoom to x axis hold **x** when panning/zooming with mouse
98+
Close all plots **shift** + **w**
99+
Constrain pan/zoom to x axis hold **x** when panning/zooming with mouse
99100
Constrain pan/zoom to y axis hold **y** when panning/zooming with mouse
100101
Preserve aspect ratio hold **CONTROL** when panning/zooming with mouse
101102
Toggle grid **g** when mouse is over an axes

lib/matplotlib/backend_tools.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,16 @@ def trigger(self, sender, event, data=None):
325325
Gcf.destroy_fig(self.figure)
326326

327327

328+
class ToolQuitAll(ToolBase):
329+
"""Tool to call the figure manager destroy method"""
330+
331+
description = 'Quit all figures'
332+
default_keymap = rcParams['keymap.quit_all']
333+
334+
def trigger(self, sender, event, data=None):
335+
Gcf.destroy_all()
336+
337+
328338
class ToolEnableAllNavigation(ToolBase):
329339
"""Tool to enable all axes for toolmanager interaction"""
330340

@@ -860,6 +870,7 @@ def _mouse_move(self, event):
860870
'grid': ToolGrid,
861871
'fullscreen': ToolFullScreen< A8E1 /span>,
862872
'quit': ToolQuit,
873+
'quit_all': ToolQuitAll,
863874
'allnav': ToolEnableAllNavigation,
864875
'nav': ToolEnableNavigation,
865876
'xscale': ToolXScale,

lib/matplotlib/rcsetup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1186,7 +1186,8 @@ def validate_hist_bins(s):
11861186
'keymap.pan': [['p'], validate_stringlist],
11871187
'keymap.zoom': [['o'], validate_stringlist],
11881188
'keymap.save': [['s', 'ctrl+s'], validate_stringlist],
1189-
'keymap.quit': [['ctrl+w', 'cmd+w'], validate_stringlist],
1189+
'keymap.quit': [['ctrl+w', 'cmd+w', 'q'], validate_stringlist],
1190+
'keymap.quit_all': [['W', 'cmd+W', 'Q'], validate_stringlist],
11901191
'keymap.grid': [['g'], validate_stringlist],
11911192
'keymap.yscale': [['l'], validate_stringlist],
11921193
'keymap.xscale': [['k', 'L'], validate_stringlist],

0 commit comments

Comments
 (0)
0