MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / _get_key

Method _get_key

lib/matplotlib/backends/backend_qt.py:438–462  ·  view source on GitHub ↗
(self, event)

Source from the content-addressed store, hash-verified

436 if exclude != key and modifiers & mask]
437
438 def _get_key(self, event):
439 event_key = event.key()
440 mods = self._mpl_modifiers(exclude=event_key)
441 try:
442 # for certain keys (enter, left, backspace, etc) use a word for the
443 # key, rather than Unicode
444 key = SPECIAL_KEYS[event_key]
445 except KeyError:
446 # Unicode defines code points up to 0x10ffff (sys.maxunicode)
447 # QT will use Key_Codes larger than that for keyboard keys that are
448 # not Unicode characters (like multimedia keys)
449 # skip these
450 # if you really want them, you should add them to SPECIAL_KEYS
451 if event_key > sys.maxunicode:
452 return None
453
454 key = chr(event_key)
455 # qt delivers capitalized letters. fix capitalization
456 # note that capslock is ignored
457 if 'shift' in mods:
458 mods.remove('shift')
459 else:
460 key = key.lower()
461
462 return '+'.join(mods + [key])
463
464 def flush_events(self):
465 # docstring inherited

Callers 2

keyPressEventMethod · 0.95
keyReleaseEventMethod · 0.95

Calls 4

_mpl_modifiersMethod · 0.95
keyMethod · 0.80
joinMethod · 0.80
removeMethod · 0.45

Tested by

no test coverage detected