Skip to content

Add bulk shortcut#73

Draft
AankiMo wants to merge 4 commits into
CravingCrates:mainfrom
AankiMo:add-bulk-shortcut
Draft

Add bulk shortcut#73
AankiMo wants to merge 4 commits into
CravingCrates:mainfrom
AankiMo:add-bulk-shortcut

Conversation

@AankiMo

@AankiMo AankiMo commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

Added new function for a bulk suggestoin keyboard shortcut.
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.

AankiMo and others added 3 commits April 12, 2026 23:32
…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.
Copilot AI review requested due to automatic review settings April 20, 2026 15:38
@CravingCrates

Copy link
Copy Markdown
Owner

Would it be possible to make the Hotkey editable in e.g. the settings window so people can use a combination of their choosing with yours being the default setting?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a Browser-level keyboard shortcut to trigger AnkiCollab’s existing “bulk suggest notes” flow, making it accessible without using the context menu.

Changes:

  • Added a Browser menu QAction bound to Ctrl+Alt+B to trigger bulk suggest on the current selection.
  • Updated the Browser context menu label to display the new shortcut hint.
  • Registered the new Browser menu initializer hook.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread plugin_source/hooks.py
Comment on lines +327 to +332
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))
browser.form.menu_Notes.addAction(action)

Copilot AI Apr 20, 2026

Copy link

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.

Copilot uses AI. Check for mistakes.
Comment thread plugin_source/hooks.py
Comment on lines 288 to 291
context_menu.addAction(
"AnkiCollab: Bulk suggest notes",
"AnkiCollab: Bulk suggest notes\tCtrl+Alt+B",
lambda: bulk_suggest_handler(browser, nids=selected_nids),
)

Copilot AI Apr 20, 2026

Copy link

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 same QAction (or a shared constant) for both the menu item and context menu so the displayed shortcut stays consistent automatically.

Copilot uses AI. Check for mistakes.
Comment thread plugin_source/hooks.py
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))

Copilot AI Apr 20, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QAction.triggered emits a boolean argument (checked). Connecting it to lambda: ... will raise a TypeError at runtime when the shortcut/action is triggered. Use aqt.qt.qconnect(action.triggered, ...) (as in gear_menu_setup.py) or make the slot accept the checked argument (e.g., lambda _=False: ...).

Suggested change
action.triggered.connect(lambda: trigger_bulk_suggest_from_browser(browser))
action.triggered.connect(lambda _checked=False: trigger_bulk_suggest_from_browser(browser))

Copilot uses AI. Check for mistakes.
@AankiMo

AankiMo commented Apr 21, 2026

Copy link
Copy Markdown
Contributor Author

Would it be possible to make the Hotkey editable in e.g. the settings window so people can use a combination of their choosing with yours being the default setting?

Most definitely, but I'd have to vibecode it / get more familiar with python first and ofc find the time. I'd suggest marking this PR as a draft or closing it while I get on that.

@AankiMo AankiMo marked this pull request as draft May 28, 2026 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants