mirror of
https://github.com/ankitects/anki.git
synced 2025-12-14 15:20:58 -05:00
Display deck names when deleting (#3058)
* - update remove decks function to return names of all deleted decks - update protobuf message to display deck names - update python files to receive message in the frontend. - add message template to ftl * update CONTRIBUTORS * format * refactor: move up deck names concatenation to tooltip api call to fix type expectations * restore core behavior and get deck name from view * fix type specs * remove new type and use str instead restore incorrectly removed lines
This commit is contained in:
parent
e8d95de426
commit
6ff42155ad
5 changed files with 23 additions and 3 deletions
|
|
@ -162,6 +162,7 @@ Lucas Scharenbroch <lucasscharenbroch@gmail.com>
|
|||
Antonio Cavallo <a.cavallo@cavallinux.eu>
|
||||
Han Yeong-woo <han@yeongwoo.dev>
|
||||
Jean Khawand <jk@jeankhawand.com>
|
||||
Pedro Schreiber <schreiber.mmb@gmail.com>
|
||||
Foxy_null <https://github.com/Foxy-null>
|
||||
Arbyste <arbyste@outlook.com>
|
||||
********************
|
||||
|
|
|
|||
|
|
@ -20,6 +20,11 @@ browsing-cards-deleted =
|
|||
[one] { $count } card deleted.
|
||||
*[other] { $count } cards deleted.
|
||||
}
|
||||
browsing-cards-deleted-with-deckname =
|
||||
{ $count ->
|
||||
[one] { $count } card deleted from {$deck_name}.
|
||||
*[other] { $count } cards deleted from {$deck_name}.
|
||||
}
|
||||
browsing-change-deck = Change Deck
|
||||
browsing-change-deck2 = Change Deck...
|
||||
browsing-change-note-type = Change Note Type
|
||||
|
|
|
|||
|
|
@ -1083,7 +1083,9 @@ class SidebarTreeView(QTreeView):
|
|||
).run_in_background()
|
||||
|
||||
def delete_decks(self, _item: SidebarItem) -> None:
|
||||
remove_decks(parent=self, deck_ids=self._selected_decks()).run_in_background()
|
||||
remove_decks(
|
||||
parent=self, deck_name=_item.name, deck_ids=self._selected_decks()
|
||||
).run_in_background()
|
||||
|
||||
# Tags
|
||||
###########################
|
||||
|
|
|
|||
|
|
@ -356,7 +356,12 @@ class DeckBrowser:
|
|||
).run_in_background()
|
||||
|
||||
def _delete(self, did: DeckId) -> None:
|
||||
remove_decks(parent=self.mw, deck_ids=[did]).run_in_background()
|
||||
deck_name = self.mw.col.decks.find_deck_in_tree(
|
||||
self._render_data.tree, did
|
||||
).name
|
||||
remove_decks(
|
||||
parent=self.mw, deck_ids=[did], deck_name=deck_name
|
||||
).run_in_background()
|
||||
|
||||
# Top buttons
|
||||
######################################################################
|
||||
|
|
|
|||
|
|
@ -16,9 +16,16 @@ def remove_decks(
|
|||
*,
|
||||
parent: QWidget,
|
||||
deck_ids: Sequence[DeckId],
|
||||
deck_name: str,
|
||||
) -> CollectionOp[OpChangesWithCount]:
|
||||
return CollectionOp(parent, lambda col: col.decks.remove(deck_ids)).success(
|
||||
lambda out: tooltip(tr.browsing_cards_deleted(count=out.count), parent=parent)
|
||||
lambda out: tooltip(
|
||||
tr.browsing_cards_deleted_with_deckname(
|
||||
count=out.count,
|
||||
deck_name=deck_name,
|
||||
),
|
||||
parent=parent,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue