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