8000 Improve Wx backend handling of modifier keys combinations · matplotlib/matplotlib@89ce223 · GitHub
[go: up one dir, main page]

Skip to content

Commit 89ce223

Browse files
Alejandro Garcíatacaswell
authored andcommitted
Improve Wx backend handling of modifier keys combinations
1 parent da8790a commit 89ce223

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

lib/matplotlib/backends/backend_wx.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,7 @@ class _FigureCanvasWxBase(FigureCanvasBase, wx.Panel):
439439
wx.WXK_CONTROL: 'control',
440440
wx.WXK_SHIFT: 'shift',
441441
wx.WXK_ALT: 'alt',
442+
wx.WXK_CAPITAL: 'caps_lock',
442443
wx.WXK_LEFT: 'left',
443444
wx.WXK_UP: 'up',
444445
wx.WXK_RIGHT: 'right',
@@ -718,11 +719,14 @@ def _get_key(self, event):
718719
else:
719720
key = None
720721

721-
for meth, prefix in (
722-
[event.AltDown, 'alt'],
723-
[event.ControlDown, 'ctrl'], ):
724-
if meth():
725-
key = '{0}+{1}'.format(prefix, key)
722+
for meth, prefix, key_name in (
723+
[event.ControlDown, 'ctrl', 'control'],
724+
[event.AltDown, 'alt', 'alt'],
725+
[event.ShiftDown, 'shift', 'shift'],):
726+
if meth() and not key_name == key:
727+
if not (key_name == 'shift' and key.isupper()):
728+
key = '{0}+{1}'.format(prefix, key)
729+
break
726730

727731
return key
728732

0 commit comments

Comments
 (0)
0