Skip to content

Command palette (quick command launcher) #337

Description

@PierreRaybaut

Summary

Add a VSCode-style command palette to the DataLab desktop application: a searchable, keyboard-driven dialog that lets the user find and run any menu command by typing part of its name or its menu path (e.g. "Processing › Fourier analysis › FFT"), without hunting through the menu bar.

Motivation

DataLab exposes a large and growing number of features spread across many menus and submenus (File, Create, Edit, ROI, Operations, Processing, Analysis, View, Plugins). Discovering or re-finding a specific command can require several clicks through nested submenus. Power users and newcomers alike benefit from a single entry point where they can type a few characters and immediately reach the right command. This pattern is now an established UX convention (VSCode "Command Palette", JetBrains "Search Everywhere", Office "Tell me what you want to do"). The browser-native sibling project DataLab-Web already ships this feature, so adding it to the desktop app keeps the two front-ends consistent.

Proposed solution

Introduce a command palette dialog that lists every menu command available for the currently active panel (signal or image), each identified by its localised menu path, with live fuzzy filtering and full keyboard navigation. Selecting an entry triggers the corresponding action exactly as if it had been picked from the menu.

Entry points (discoverability)

  • Search field in the top-right corner of the menu bar — a read-only, search-box-styled field showing a magnifier icon and the placeholder "Search a command… (Ctrl+Shift+P)". Clicking it (or pressing Enter/Space when focused) opens the palette. This makes the feature visible at a glance, mirroring the DataLab-Web trigger button placed at the top-right of the window.
  • Menu entry — a "Command palette…" item at the top of the ? (Help) menu, carrying the same icon and the Ctrl+Shift+P shortcut, so the feature is also discoverable through the menus and via keyboard.
  • Global keyboard shortcutCtrl+Shift+P (the de-facto command-palette shortcut; free in DataLab desktop).

Behaviour

  • Search by menu path. Each command is presented as its full localised path (e.g. "Processing › Fourier analysis › FFT"), so users can search the same way they navigate the menus.
  • Fuzzy matching. A subsequence matcher (consecutive-match and word-boundary bonuses, gap penalty) ranks results, so "fft" or "fan" find "Fourier analysis" entries quickly. With an empty query, all commands are listed alphabetically by path.
  • Keyboard-first. Up/Down move the highlight (skipping disabled entries), Enter runs the highlighted command, Escape closes the palette. The mouse works too (click to run).
  • Availability awareness. Commands that are currently disabled (e.g. operations requiring a selection when nothing is selected) are shown greyed and are not selectable — matching the menu-bar state and the DataLab-Web behaviour.
  • Panel-aware. The palette reflects the active panel: switching between the Signal and Image panels lists that panel's commands.

Command scope

Commands are collected from the nine action categories that feed the menu bar: File, Create, Edit, ROI, Operations, Processing, Analysis, View, Plugins. Context-menu-only entries and dynamic view dock toggles are out of scope for the first iteration.

Acceptance criteria

  • A search field is visible at the top-right of the menu bar and opens the palette on click.
  • Ctrl+Shift+P opens (and toggles/closes) the palette from anywhere in the main window.
  • A "Command palette…" entry appears in the ? (Help) menu, showing the shortcut.
  • Typing filters the list by localised menu path with fuzzy matching; Up/Down/Enter/Escape behave as described; disabled commands are greyed and non-selectable.
  • Selecting a command runs it on the current panel exactly as the equivalent menu item would.
  • All user-facing strings are translatable (_()), with French translations provided.

Implementation notes

  • New module datalab/gui/commandpalette.py: the fuzzy matcher, a collect_commands(window, panel) helper that walks the panel's get_category_actions(...) for each category and builds the localised paths, the CommandPaletteDialog, and the CommandSearchField (the menu-bar search-box launcher).
  • New icon datalab/data/icons/command_palette.svg (magnifier).
  • datalab/gui/main.py: a global command_palette_action (Ctrl+Shift+P) created in __setup_global_actions, the corner search field and the ?-menu entry wired in __add_menus, and a show_command_palette() method that builds the dialog and triggers the chosen action.
  • Tests in datalab/tests/backbone/commandpalette_unit_test.py cover the fuzzy matcher, command collection / dialog filtering, and the search-field launcher.
  • Internationalisation: new strings added to the French catalog and compiled.

Out of scope / possible follow-ups

  • Including context-menu-only and dock-toggle commands.
  • Recently-used / favourite commands, or showing keyboard shortcuts next to each result.
  • A guided-tour step introducing the palette to first-time users.

References

  • DataLab-Web command palette (parity source): src/components/CommandPalette.tsx, src/actions/commandSearch.ts, src/actions/buildMenu.ts (flattenMenuLeaves).

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions