Keyboard Shortcuts - #89
Conversation
…log-darkmode Copilot/fix notification dialog darkmode
Testing revealed that a more minimal approach wasnt working for me. may not be optimal, but works. Disclosure: ChatGPT 5.3 Codex was used for this Commit.
…epo on ankicollab beta files
There was a problem hiding this comment.
Pull request overview
This PR enhances the add-on’s UX by expanding the Global Settings dialog and introducing configurable keyboard shortcuts for “Update Decks” (main window) and “Bulk Suggest” (Browser), including displaying shortcut hints in relevant menus.
Changes:
- Expanded the Global Settings dialog layout and added a “Keyboard Shortcuts” section with QKeySequenceEdit inputs.
- Persisted new shortcut settings and surfaced shortcut hints in menu labels.
- Added Browser menu integration for Bulk Suggest and attempted to register an Update Decks shortcut on the main window.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| plugin_source/menu.py | Adds UI for configuring shortcuts, validates/saves shortcut values, and appends a shortcut hint to the Update Decks menu item label. |
| plugin_source/hooks.py | Adds shortcut config helpers, adds a Browser “Bulk suggest notes” action with shortcut, and registers an Update Decks shortcut action. |
Comments suppressed due to low confidence (1)
plugin_source/menu.py:1127
- Shortcut strings are persisted using keySequence.toString() without specifying the format. That will store NativeText on some platforms (e.g. "⌃⌥U" on macOS), which may not round-trip reliably across platforms and also makes downstream parsing/validation harder. Persist in PortableText so hooks.py can parse consistently and UI can still render NativeText for display.
settings["shortcut_update_decks"] = update_seq.toString() if not update_seq.isEmpty() else ""
settings["shortcut_bulk_suggest"] = bulk_seq.toString() if not bulk_seq.isEmpty() else ""
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
| save_button = QPushButton('Save Settings') | ||
| save_button.setStyleSheet(get_button_style('success')) | ||
|
|
||
| def _validate_shortcut(seq: QKeySequence) -> bool: |
There was a problem hiding this comment.
Just brainstorming, but it could be nice to have some kind of collision checks so we don't accidentally overwrite a already-used Shortcut from anki. I can already see the user issue reports in front of me
|
sorry about the mistake with the unwanted commits, should be ok now |
introduces configurable global keyboard shortcuts for bulk suggesting and for update decks. slight redesign of settings dialog was necessary
Keyboard Shortcuts:
Global Settings Dialog Enhancements: