Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix qt key mods#20868

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
timhoffm merged 2 commits intomatplotlib:masterfromtacaswell:fix_qt_key_mods
Aug 20, 2021
Merged
Changes fromall 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
9 changes: 7 additions & 2 deletionslib/matplotlib/tests/test_backend_qt.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -106,7 +106,9 @@ def CustomHandler(signum, frame):
('Key_Control', ['AltModifier'], 'alt+control'),
('Key_Alt', ['ControlModifier'], 'ctrl+alt'),
('Key_Aacute', ['ControlModifier', 'AltModifier', 'MetaModifier'],
'ctrl+alt+super+\N{LATIN SMALL LETTER A WITH ACUTE}'),
'ctrl+alt+meta+\N{LATIN SMALL LETTER A WITH ACUTE}'),
# We do not currently map the media keys, this may change in the
# future. This means the callback will never fire
('Key_Play', [], None),
('Key_Backspace', [], 'backspace'),
('Key_Backspace', ['ControlModifier'], 'ctrl+backspace'),
Expand DownExpand Up@@ -142,6 +144,7 @@ def test_correct_key(backend, qt_core, qt_key, qt_mods, answer):
Assert sent and caught keys are the same.
"""
from matplotlib.backends.qt_compat import _enum, _to_int
result = None
qt_mod = _enum("QtCore.Qt.KeyboardModifier").NoModifier
for mod in qt_mods:
qt_mod |= getattr(_enum("QtCore.Qt.KeyboardModifier"), mod)
Expand All@@ -152,11 +155,13 @@ def key(self): return _to_int(getattr(_enum("QtCore.Qt.Key"), qt_key))
def modifiers(self): return qt_mod

def on_key_press(event):
assert event.key == answer
nonlocal result
result = event.key

qt_canvas = plt.figure().canvas
qt_canvas.mpl_connect('key_press_event', on_key_press)
qt_canvas.keyPressEvent(_Event())
assert result == answer


@pytest.mark.backend('QtAgg', skip_on_importerror=True)
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp