diff --git a/ftl/core/browsing.ftl b/ftl/core/browsing.ftl index d473c8180..cb676d53c 100644 --- a/ftl/core/browsing.ftl +++ b/ftl/core/browsing.ftl @@ -115,7 +115,7 @@ browsing-note-deleted = [one] { $count } note deleted. *[other] { $count } notes deleted. } -browsing-notes-updated = +browsing-notes-updated = { $count -> [one] { $count } note updated. *[other] { $count } notes updated. diff --git a/ftl/core/decks.ftl b/ftl/core/decks.ftl index 3ffe2a470..fb7451edf 100644 --- a/ftl/core/decks.ftl +++ b/ftl/core/decks.ftl @@ -1,5 +1,4 @@ decks-add-new-deck-ctrlandn = Add New Deck (Ctrl+N) -decks-are-you-sure-you-wish-to = Are you sure you wish to delete { $val }? decks-build = Build decks-cards-selected-by = cards selected by decks-create-deck = Create Deck @@ -32,8 +31,3 @@ decks-study = Study decks-study-deck = Study Deck decks-the-provided-search-did-not-match = The provided search did not match any cards. Would you like to revise it? decks-unmovable-cards = Show any excluded cards -decks-it-has-card = - { $count -> - [one] It has { $count } card. - *[other] It has { $count } cards. - } diff --git a/qt/aqt/deckbrowser.py b/qt/aqt/deckbrowser.py index bbaeae8b0..a48c8de9c 100644 --- a/qt/aqt/deckbrowser.py +++ b/qt/aqt/deckbrowser.py @@ -5,7 +5,7 @@ from __future__ import annotations from concurrent.futures import Future from copy import deepcopy from dataclasses import dataclass -from typing import Any, List +from typing import Any import aqt from anki.decks import DeckTreeNode @@ -23,6 +23,7 @@ from aqt.utils import ( shortcut, showInfo, showWarning, + tooltip, tr, ) @@ -295,38 +296,16 @@ class DeckBrowser: gui_hooks.sidebar_should_refresh_decks() self.show() - def ask_delete_deck(self, did: int) -> bool: - return self.ask_delete_decks([did]) - - def ask_delete_decks(self, dids: List[int]) -> bool: - decks = [self.mw.col.decks.get(did) for did in dids] - if all([deck["dyn"] for deck in decks]): - return True - - count = self.mw.col.decks.card_count(dids, include_subdecks=True) - if not count: - return True - - if len(dids) == 1: - extra = tr(TR.DECKS_IT_HAS_CARD, count=count) - return askUser( - f"{tr(TR.DECKS_ARE_YOU_SURE_YOU_WISH_TO, val=decks[0]['name'])} {extra}" - ) - - return askUser(tr(TR.DECKS_CONFIRM_DELETION, count=count)) - def _delete(self, did: int) -> None: - if self.ask_delete_deck(did): + def do_delete() -> int: + return self.mw.col.decks.remove([did]) - def do_delete() -> None: - return self.mw.col.decks.rem(did, True) + def on_done(fut: Future) -> None: + self.show() + tooltip(tr(TR.BROWSING_CARDS_DELETED, count=fut.result())) - def on_done(fut: Future) -> None: - self.show() - res = fut.result() # Required to check for errors - - self.mw.checkpoint(tr(TR.DECKS_DELETE_DECK)) - self.mw.taskman.with_progress(do_delete, on_done) + self.mw.checkpoint(tr(TR.DECKS_DELETE_DECK)) + self.mw.taskman.with_progress(do_delete, on_done) # Top buttons ###################################################################### diff --git a/qt/aqt/sidebar.py b/qt/aqt/sidebar.py index 766424782..6ce7d3427 100644 --- a/qt/aqt/sidebar.py +++ b/qt/aqt/sidebar.py @@ -1148,7 +1148,7 @@ class SidebarTreeView(QTreeView): def _remove_tags(self, _item: SidebarItem) -> None: tags = self._selected_tags() - def do_remove() -> None: + def do_remove() -> int: return self.col._backend.expunge_tags(" ".join(tags)) def on_done(fut: Future) -> None: @@ -1199,7 +1199,7 @@ class SidebarTreeView(QTreeView): self.browser.editor.saveNow(self._delete_decks) def _delete_decks(self) -> None: - def do_delete() -> None: + def do_delete() -> int: return self.mw.col.decks.remove(dids) def on_done(fut: Future) -> None: