Convert Matplotlib key presses to GTK+ accelerator identifiers. Related to `FigureCanvasGTK4._get_key`.
(self, key)
| 542 | @backend_tools._register_tool_class(FigureCanvasGTK4) |
| 543 | class HelpGTK4(backend_tools.ToolHelpBase): |
| 544 | def _normalize_shortcut(self, key): |
| 545 | """ |
| 546 | Convert Matplotlib key presses to GTK+ accelerator identifiers. |
| 547 | |
| 548 | Related to `FigureCanvasGTK4._get_key`. |
| 549 | """ |
| 550 | special = { |
| 551 | 'backspace': 'BackSpace', |
| 552 | 'pagedown': 'Page_Down', |
| 553 | 'pageup': 'Page_Up', |
| 554 | 'scroll_lock': 'Scroll_Lock', |
| 555 | } |
| 556 | |
| 557 | parts = key.split('+') |
| 558 | mods = ['<' + mod + '>' for mod in parts[:-1]] |
| 559 | key = parts[-1] |
| 560 | |
| 561 | if key in special: |
| 562 | key = special[key] |
| 563 | elif len(key) > 1: |
| 564 | key = key.capitalize() |
| 565 | elif key.isupper(): |
| 566 | mods += ['<shift>'] |
| 567 | |
| 568 | return ''.join(mods) + key |
| 569 | |
| 570 | def _is_valid_shortcut(self, key): |
| 571 | """ |