|
24 | 24 | from napari.utils.history import get_save_history, update_save_history
|
25 | 25 | from qtpy.QtCore import Qt, QTimer, Signal, QPoint, QSettings, QSize
|
26 | 26 | from qtpy.QtGui import QPainter, QAction, QCursor, QIcon
|
| 27 | +from qtpy.QtSvgWidgets import QSvgWidget |
27 | 28 | from qtpy.QtWidgets import (
|
28 | 29 | QButtonGroup,
|
29 | 30 | QCheckBox,
|
@@ -65,18 +66,16 @@ def __init__(self, parent):
|
65 | 66 | super().__init__(parent=parent)
|
66 | 67 | self.setParent(parent)
|
67 | 68 | self.setWindowTitle("Shortcuts")
|
| 69 | + |
| 70 | + image_path = str(Path(__file__).parent / "assets" / "napari_shortcuts.svg") |
| 71 | + |
68 | 72 | vlayout = QVBoxLayout()
|
69 |
| - shortcuts = """ |
70 |
| - * `2` and `3`, to switch between labeling and selection mode |
71 |
| - * `4`, to enable pan & zoom |
72 |
| - * `M`, to cycle through regular (sequential), quick, and loop annotation mode |
73 |
| - * `E`, to enable edge coloring |
74 |
| - * `F`, to toggle between animal and body part color scheme |
75 |
| - * `V`, to toggle visibility of the selected layer |
76 |
| - * `backspace`, to delete a point |
77 |
| - """ |
78 |
| - message = QLabel(shortcuts) |
79 |
| - vlayout.addWidget(message) |
| 73 | + background_widget = QWidget() |
| 74 | + background_widget.setStyleSheet("background-color: white;") |
| 75 | + svg_widget = QSvgWidget(image_path) |
| 76 | + vlayout.addWidget(background_widget) |
| 77 | + vlayout.addWidget(svg_widget) |
| 78 | + vlayout.setContentsMargins(0, 0, 0, 0) |
80 | 79 | self.setLayout(vlayout)
|
81 | 80 |
|
82 | 81 |
|
@@ -643,9 +642,9 @@ def __init__(self, napari_viewer):
|
643 | 642 | self.viewer.window.view_menu.addAction(launch_tutorial)
|
644 | 643 |
|
645 | 644 | # Add action to view keyboard shortcuts
|
646 |
| - display_shortcuts = QAction("&Shortcuts", self) |
647 |
| - display_shortcuts.triggered.connect(self.display_shortcuts) |
648 |
| - self.viewer.window.help_menu.addAction(display_shortcuts) |
| 645 | + display_shortcuts_action = QAction("&Shortcuts", self) |
| 646 | + display_shortcuts_action.triggered.connect(self.display_shortcuts) |
| 647 | + self.viewer.window.help_menu.addAction(display_shortcuts_action) |
649 | 648 |
|
650 | 649 | # Hide some unused viewer buttons
|
651 | 650 | self.viewer.window._qt_viewer.viewerButtons.gridViewButton.hide()
|
|
0 commit comments