Skip to content

Avoid spurious deprecation warning in TextBox. #17043

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
Apr 7, 2020
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
12 changes: 7 additions & 5 deletions lib/matplotlib/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -847,12 +847,14 @@ def begin_typing(self, x):
self.capturekeystrokes = True
# Check for toolmanager handling the keypress
if self.ax.figure.canvas.manager.key_press_handler_id is not None:
# disable command keys so that the user can type without
# command keys causing figure to be saved, etc
# Disable command keys so that the user can type without
# command keys causing figure to be saved, etc.
self._restore_keymap = ExitStack()
self._restore_keymap.enter_context(
mpl.rc_context(
{k: [] for k in mpl.rcParams if k.startswith('keymap.')}))
# Avoid spurious warnings if keymaps are getting deprecated.
with cbook._suppress_matplotlib_deprecation_warning():
self._restore_keymap.enter_context(
mpl.rc_context({k: [] for k in mpl.rcParams
if k.startswith('keymap.')}))
else:
self.ax.figure.canvas.manager.toolmanager.keypresslock(self)

Expand Down