-
Notifications
You must be signed in to change notification settings - Fork 29
Add bulk shortcut #73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
0479ce6
f6a0b09
478a443
ec7daa4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -77,6 +77,9 @@ def bulk_suggest_handler(browser: Browser, nids: Sequence[NoteId]) -> None: | |||||
| return | ||||||
| suggest_notes(nids, 9) | ||||||
|
|
||||||
| def trigger_bulk_suggest_from_browser(browser: Browser) -> None: | ||||||
| bulk_suggest_handler(browser, browser.selected_notes()) | ||||||
|
|
||||||
| def remove_notes(nids: Sequence[NoteId], window=None) -> None: | ||||||
| if not auth_manager.is_logged_in(): | ||||||
| showInfo("Please log in to remove notes.", parent=window if window is not None else mw) | ||||||
|
|
@@ -283,7 +286,7 @@ def context_menu_bulk_suggest(browser: Browser, context_menu: QMenu) -> None: | |||||
|
|
||||||
| context_menu.addSeparator() | ||||||
| context_menu.addAction( | ||||||
| "AnkiCollab: Bulk suggest notes", | ||||||
| "AnkiCollab: Bulk suggest notes\tCtrl+Alt+B", | ||||||
| lambda: bulk_suggest_handler(browser, nids=selected_nids), | ||||||
| ) | ||||||
| context_menu.addAction( | ||||||
|
|
@@ -321,6 +324,13 @@ def context_menu_bulk_suggest(browser: Browser, context_menu: QMenu) -> None: | |||||
| except Exception: | ||||||
| pass | ||||||
|
|
||||||
| def add_browser_bulk_suggest_action(browser: Browser) -> None: | ||||||
| action = QAction("AnkiCollab: Bulk suggest notes", browser) | ||||||
| action.setShortcut(QKeySequence("Ctrl+Alt+B")) | ||||||
| action.setShortcutContext(Qt.WidgetWithChildrenShortcut) | ||||||
| action.triggered.connect(lambda: trigger_bulk_suggest_from_browser(browser)) | ||||||
|
||||||
| action.triggered.connect(lambda: trigger_bulk_suggest_from_browser(browser)) | |
| action.triggered.connect(lambda _checked=False: trigger_bulk_suggest_from_browser(browser)) |
Copilot
AI
Apr 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add_browser_bulk_suggest_action() adds the menu/shortcut action even when logged out, unlike other browser menu initializers (e.g., add_browser_menu_item() and context_menu_bulk_suggest()) which early-return when not logged in. Consider adding the same auth_manager.is_logged_in() guard here to avoid exposing non-functional menu items/shortcuts to logged-out users.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The shortcut string (
Ctrl+Alt+B) is now duplicated in two places: embedded in the context menu label and set on the QAction. This can drift over time if the shortcut ever changes. Prefer reusing the sameQAction(or a shared constant) for both the menu item and context menu so the displayed shortcut stays consistent automatically.