Exemplo n.º 1
0
    def on_unbury(self) -> None:
        mode = UnburyDeck.Mode.ALL
        if self.mw.col.schedVer() != 1:
            info = self.mw.col.sched.congratulations_info()
            if info.have_sched_buried and info.have_user_buried:
                opts = [
                    tr.studying_manually_buried_cards(),
                    tr.studying_buried_siblings(),
                    tr.studying_all_buried_cards(),
                    tr.actions_cancel(),
                ]

                diag = askUserDialog(
                    tr.studying_what_would_you_like_to_unbury(), opts)
                diag.setDefault(0)
                ret = diag.run()
                if ret == opts[0]:
                    mode = UnburyDeck.Mode.USER_ONLY
                elif ret == opts[1]:
                    mode = UnburyDeck.Mode.SCHED_ONLY
                elif ret == opts[3]:
                    return

        unbury_deck(parent=self.mw,
                    deck_id=self.mw.col.decks.get_current_id(),
                    mode=mode).run_in_background()
Exemplo n.º 2
0
    def onUnbury(self) -> None:
        if self.mw.col.schedVer() == 1:
            self.mw.col.sched.unburyCardsForDeck()
            self.mw.reset()
            return

        info = self.mw.col.sched.congratulations_info()
        if info.have_sched_buried and info.have_user_buried:
            opts = [
                tr.studying_manually_buried_cards(),
                tr.studying_buried_siblings(),
                tr.studying_all_buried_cards(),
                tr.actions_cancel(),
            ]

            diag = askUserDialog(tr.studying_what_would_you_like_to_unbury(), opts)
            diag.setDefault(0)
            ret = diag.run()
            if ret == opts[0]:
                self.mw.col.sched.unburyCardsForDeck(type="manual")
            elif ret == opts[1]:
                self.mw.col.sched.unburyCardsForDeck(type="siblings")
            elif ret == opts[2]:
                self.mw.col.sched.unburyCardsForDeck(type="all")
        else:
            self.mw.col.sched.unburyCardsForDeck(type="all")

        self.mw.reset()