Skip to content

Commit 8571ceb

Browse files
feat(shortcuts): add an info dialog with keyboard shortcuts
1 parent 4f991b8 commit 8571ceb

4 files changed

Lines changed: 78 additions & 7 deletions

File tree

.github/workflows/test_and_release.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,3 @@ jobs:
8383
uses: python-semantic-release/python-semantic-release@master
8484
with:
8585
github_token: ${{ secrets.GITHUB_TOKEN }}
86-
87-
# https://docs.pypi.org/trusted-publishers/using-a-publisher/
88-
- name: Publish package distributions to PyPI
89-
if: steps.release.outputs.released == 'true'
90-
uses: pypa/gh-action-pypi-publish@release/v1

CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
- **slicer viewer**: Add a slicer viewer to display dicom files
1010
([`6b250e2`](https://github.com/KitwareMedical/GirderEEGViewer/commit/6b250e29a0a995fcb31b3ca65eb3892ef0231d6f))
1111

12-
1312
## v1.0.0 (2026-05-29)
1413

1514
- Initial Release
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
from trame.widgets import vuetify3 as v3
2+
from trame.widgets.html import Div, Span
3+
4+
SHORTCUTS = {
5+
"selection": [
6+
(["alpha-a"], "Select all"),
7+
(["alpha-z"], "Select none"),
8+
(["alpha-i"], "Invert selection"),
9+
],
10+
"modes": [
11+
(["keyboard-tab"], "Switch mode"),
12+
(["alpha-c"], "Toggle calibration"),
13+
],
14+
"tools": [
15+
(["chevron-left", "chevron-right"], "Move time"),
16+
(["alpha-u", "alpha-d"], "Scale time up and down"),
17+
(["chevron-up", "chevron-down"], "Scale or calibrate up and down"),
18+
(["alpha-r"], "Reset scale"),
19+
(["keyboard-space"], "Next profile"),
20+
(["alpha-v"], "Next filter"),
21+
],
22+
"annotations": [
23+
(["keyboard-return"], "Add annotation"),
24+
(["alpha-k"], "Delete annotation"),
25+
(["alpha-p", "alpha-n"], "Change annotation type"),
26+
(["keyboard-esc"], "Cancel annotation"),
27+
],
28+
}
29+
30+
31+
class ShortcutInfo(Div):
32+
def __init__(self, icons: list[str], desc: str, **kwargs) -> None:
33+
super().__init__(classes="d-flex justify-space-between pa-2", **kwargs)
34+
with self:
35+
with Div(classes="d-flex", style="gap: 8px;"):
36+
for icon in icons:
37+
v3.VIcon(icon=f"mdi-{icon}")
38+
Span(desc, classes="text-body-2")
39+
40+
41+
class ShortcutsPanel(Div):
42+
def __init__(self, **kwargs) -> None:
43+
super().__init__(
44+
classes="d-flex justify-end ma-7", style="inset: 0; position: absolute; pointer-events: none;", **kwargs
45+
)
46+
47+
self._build_ui()
48+
49+
def _build_ui(self) -> None:
50+
with self, v3.VDialog(width=400):
51+
with (
52+
v3.Template(v_slot_activator="{ props : activatorProps }"),
53+
v3.VBtn(
54+
v_bind="activatorProps",
55+
icon="mdi-plus",
56+
raw_attrs=['tabindex="-1"'],
57+
color="white",
58+
style="pointer-events: visible;",
59+
size="small",
60+
),
61+
):
62+
v3.VTooltip(
63+
activator="parent",
64+
close_delay=100,
65+
open_delay=500,
66+
text="Keyboard shortcuts",
67+
)
68+
v3.VIcon(icon="mdi-information-outline")
69+
70+
with v3.VCard(), v3.VCardText():
71+
for shortcut_theme, shortcuts in SHORTCUTS.items():
72+
Div(shortcut_theme, classes="text-uppercase text-overline")
73+
for shortcut_icons, shortcut_desc in shortcuts:
74+
ShortcutInfo(shortcut_icons, shortcut_desc)

girdereegviewer/eeg_viewer/eeg_viewer_ui.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@
33
from trame.widgets.vuetify3 import VMain
44
from trame_server import Server
55

6+
from .eeg_viewer_shortcuts_panel import ShortcutsPanel
7+
68

79
class EEGViewerUI:
810
def __init__(self, server: Server):
911
self.template_name = "eeg-viewer"
10-
with VAppLayout(server, template_name=self.template_name), VMain(classes="d-flex flex-column"):
12+
with VAppLayout(server, template_name=self.template_name), VMain(classes="d-flex flex-column pb-2"):
1113
self.rca = rca.RemoteControlledArea(name="eeg-view", display="image", send_mouse_move=True)
14+
ShortcutsPanel()

0 commit comments

Comments
 (0)