(self, *args)
| 577 | return 'cmd+' not in key and not key.startswith('MouseButton.') |
| 578 | |
| 579 | def trigger(self, *args): |
| 580 | section = Gtk.ShortcutsSection() |
| 581 | |
| 582 | for name, tool in sorted(self.toolmanager.tools.items()): |
| 583 | if not tool.description: |
| 584 | continue |
| 585 | |
| 586 | # Putting everything in a separate group allows GTK to |
| 587 | # automatically split them into separate columns/pages, which is |
| 588 | # useful because we have lots of shortcuts, some with many keys |
| 589 | # that are very wide. |
| 590 | group = Gtk.ShortcutsGroup() |
| 591 | section.append(group) |
| 592 | # A hack to remove the title since we have no group naming. |
| 593 | child = group.get_first_child() |
| 594 | while child is not None: |
| 595 | child.set_visible(False) |
| 596 | child = child.get_next_sibling() |
| 597 | |
| 598 | shortcut = Gtk.ShortcutsShortcut( |
| 599 | accelerator=' '.join( |
| 600 | self._normalize_shortcut(key) |
| 601 | for key in self.toolmanager.get_tool_keymap(name) |
| 602 | if self._is_valid_shortcut(key)), |
| 603 | title=tool.name, |
| 604 | subtitle=tool.description) |
| 605 | group.append(shortcut) |
| 606 | |
| 607 | window = Gtk.ShortcutsWindow( |
| 608 | title='Help', |
| 609 | modal=True, |
| 610 | transient_for=self._figure.canvas.get_root()) |
| 611 | window.set_child(section) |
| 612 | |
| 613 | window.show() |
| 614 | |
| 615 | |
| 616 | @backend_tools._register_tool_class(FigureCanvasGTK4) |
nothing calls this directly
no test coverage detected