From 7364d75bd6d32719cf0f7e80cbd49265c9fbc9eb Mon Sep 17 00:00:00 2001 From: Michael Malyuk Date: Sat, 14 Jun 2025 16:42:13 -0700 Subject: [PATCH 01/12] implementation of custom hotkeys, most of the code is around customization Signed-off-by: Michael Malyuk --- label_studio/templates/base.html | 66 ++- label_studio/users/api.py | 22 +- label_studio/users/functions.py | 1 + .../migrations/0011_user_custom_hotkeys.py | 18 + label_studio/users/models.py | 3 +- label_studio/users/serializers.py | 66 ++- label_studio/users/urls.py | 3 + label_studio/users/views.py | 2 +- .../src/components/Menubar/Menubar.jsx | 13 +- .../src/components/Menubar/Menubar.scss | 17 + .../pages/AccountSettings/AccountSettings.tsx | 100 ++-- .../AccountSettings/sections/Hotkeys.jsx | 525 ++++++++++++++++++ .../AccountSettings/sections/Hotkeys.scss | 263 +++++++++ .../AccountSettings/sections/Hotkeys/Help.jsx | 251 +++++++++ .../sections/Hotkeys/Import.jsx | 92 +++ .../AccountSettings/sections/Hotkeys/Item.jsx | 143 +++++ .../AccountSettings/sections/Hotkeys/Key.jsx | 8 + .../sections/Hotkeys/Section.jsx | 112 ++++ .../sections/Hotkeys/defaults.js | 133 +++++ .../AccountSettings/sections/PersonalInfo.tsx | 1 + .../pages/AccountSettings/sections/index.tsx | 7 + .../SidePanels/Components/LockButton.tsx | 4 +- .../SidePanels/DetailsPanel/RegionItem.tsx | 2 +- .../editor/src/components/Toolbar/Tool.jsx | 25 +- .../editor/src/components/Toolbar/Toolbar.jsx | 2 +- web/libs/editor/src/core/Hotkey.ts | 42 +- web/libs/editor/src/core/settings/keymap.json | 97 +++- .../src/stores/Annotation/Annotation.js | 6 + web/libs/editor/src/stores/AppStore.js | 13 + web/libs/editor/src/tools/Brush.jsx | 6 +- web/libs/editor/src/tools/Ellipse.js | 2 +- web/libs/editor/src/tools/Erase.jsx | 6 +- web/libs/editor/src/tools/KeyPoint.js | 2 +- web/libs/editor/src/tools/MagicWand.jsx | 4 +- web/libs/editor/src/tools/Polygon.js | 2 +- web/libs/editor/src/tools/Rect.js | 6 +- web/libs/editor/src/tools/Rotate.jsx | 4 +- web/libs/editor/src/tools/Selection.js | 2 +- web/libs/editor/src/tools/Zoom.jsx | 10 +- web/libs/ui/src/assets/icons/hotkeys.svg | 3 + web/libs/ui/src/assets/icons/index.ts | 1 + 41 files changed, 1998 insertions(+), 87 deletions(-) create mode 100644 label_studio/users/migrations/0011_user_custom_hotkeys.py create mode 100644 web/libs/app-common/src/pages/AccountSettings/sections/Hotkeys.jsx create mode 100644 web/libs/app-common/src/pages/AccountSettings/sections/Hotkeys.scss create mode 100644 web/libs/app-common/src/pages/AccountSettings/sections/Hotkeys/Help.jsx create mode 100644 web/libs/app-common/src/pages/AccountSettings/sections/Hotkeys/Import.jsx create mode 100644 web/libs/app-common/src/pages/AccountSettings/sections/Hotkeys/Item.jsx create mode 100644 web/libs/app-common/src/pages/AccountSettings/sections/Hotkeys/Key.jsx create mode 100644 web/libs/app-common/src/pages/AccountSettings/sections/Hotkeys/Section.jsx create mode 100644 web/libs/app-common/src/pages/AccountSettings/sections/Hotkeys/defaults.js create mode 100644 web/libs/ui/src/assets/icons/hotkeys.svg diff --git a/label_studio/templates/base.html b/label_studio/templates/base.html index 4f9cc5769ad0..d2bf1f800ad3 100644 --- a/label_studio/templates/base.html +++ b/label_studio/templates/base.html @@ -98,26 +98,88 @@