show the number of cards added when adding

This commit is contained in:
llama 2025-09-01 22:14:25 +08:00
parent c4cfcee4a5
commit 5386817c11
No known key found for this signature in database
GPG key ID: 0B7543854B9413C3
2 changed files with 8 additions and 3 deletions

View file

@ -1,5 +1,10 @@
adding-add-shortcut-ctrlandenter = Add (shortcut: ctrl+enter) adding-add-shortcut-ctrlandenter = Add (shortcut: ctrl+enter)
adding-added = Added adding-added = Added
adding-added-cards =
Added { $count ->
[one] { $count } card
*[other] { $count } cards
}
adding-discard-current-input = Discard current input? adding-discard-current-input = Discard current input?
adding-keep-editing = Keep Editing adding-keep-editing = Keep Editing
adding-edit = Edit "{ $val }" adding-edit = Edit "{ $val }"

View file

@ -8,7 +8,7 @@ from collections.abc import Callable
import aqt.editor import aqt.editor
import aqt.forms import aqt.forms
from anki._legacy import deprecated from anki._legacy import deprecated
from anki.collection import OpChanges, SearchNode from anki.collection import OpChanges, OpChangesWithCount, SearchNode
from anki.decks import DeckId from anki.decks import DeckId
from anki.models import NotetypeId from anki.models import NotetypeId
from anki.notes import Note, NoteFieldsCheckResult, NoteId from anki.notes import Note, NoteFieldsCheckResult, NoteId
@ -294,13 +294,13 @@ class AddCards(QMainWindow):
target_deck_id = self.deck_chooser.selected_deck_id target_deck_id = self.deck_chooser.selected_deck_id
def on_success(changes: OpChanges) -> None: def on_success(changes: OpChangesWithCount) -> None:
# only used for detecting changed sticky fields on close # only used for detecting changed sticky fields on close
self._last_added_note = note self._last_added_note = note
self.addHistory(note) self.addHistory(note)
tooltip(tr.adding_added(), period=500) tooltip(tr.adding_added_cards(count=changes.count), period=500)
av_player.stop_and_clear_queue() av_player.stop_and_clear_queue()
self._load_new_note(sticky_fields_from=note) self._load_new_note(sticky_fields_from=note)
gui_hooks.add_cards_did_add_note(note) gui_hooks.add_cards_did_add_note(note)