seperate ask_delete_deck and _delete method

This commit is contained in:
BlueGreenMagick 2021-01-05 19:28:19 +09:00
parent 94fe1f898f
commit f6f06986d0

View File

@ -280,8 +280,7 @@ class DeckBrowser:
self.show()
def _delete(self, did: int):
self.mw.checkpoint(tr(TR.DECKS_DELETE_DECK))
def ask_delete_deck(self, did: int) -> bool:
deck = self.mw.col.decks.get(did)
extra = None
if not deck["dyn"]:
@ -292,9 +291,15 @@ class DeckBrowser:
deck["dyn"]
or not extra
or askUser(
(tr(TR.DECKS_ARE_YOU_SURE_YOU_WISH_TO, val=deck["name"])) + extra
(tr(TR.DECKS_ARE_YOU_SURE_YOU_WISH_TO, val=deck["name"])) + " " + extra
)
):
return True
return False
def _delete(self, did: int) -> None:
if self.ask_delete_deck(did):
self.mw.checkpoint(tr(TR.DECKS_DELETE_DECK))
self.mw.progress.start()
self.mw.col.decks.rem(did, True)
self.mw.progress.finish()