8000 acquiring and releasing keypresslock when textbox is being activated by fariza · Pull Request #14343 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

acquiring and releasing keypresslock when textbox is being activated #14343

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 3 commits into from
May 30, 2019
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
10000 Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 17 additions & 10 deletions lib/matplotlib/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -856,23 +856,30 @@ def _notify_change_observers(self):

def begin_typing(self, x):
self.capturekeystrokes = True
# disable command keys so that the user can type without
# command keys causing figure to be saved, etc
self.reset_params = {}
for key in self.params_to_disable:
self.reset_params[key] = rcParams[key]
rcParams[key] = []
if rcParams['toolbar'] != 'toolmanager':
# disable command keys so that the user can type without
# command keys causing figure to be saved, etc
self.reset_params = {}
for key in self.params_to_disable:
self.reset_params[key] = rcParams[key]
rcParams[key] = []
else:
self.ax.figure.canvas.manager.toolmanager.keypresslock(self)

def stop_typing(self):
notifysubmit = False
# because _notify_submit_users might throw an error in the
# user's code, we only want to call it once we've already done
# our cleanup.
if self.capturekeystrokes:
# since the user is no longer typing,
# reactivate the standard command keys
for key in self.params_to_disable:
rcParams[key] = self.reset_params[key]
if rcParams['toolbar'] != 'toolmanager':
# since the user is no longer typing,
# reactivate the standard command keys
for key in self.params_to_disable:
rcParams[key] = self.reset_params[key]
else:
toolmanager = self.ax.figure.canvas.manager.toolmanager
toolmanager.keypresslock.release(self)
notifysubmit = True
self.capturekeystrokes = False
self.cursor.set_visible(False)
Expand Down
0