コード例 #1
0
ファイル: reviewer.py プロジェクト: qwcbw/anki
 def nextCard(self) -> None:
     elapsed = self.mw.col.timeboxReached()
     if elapsed:
         assert not isinstance(elapsed, bool)
         part1 = tr.studying_card_studied_in(count=elapsed[1])
         mins = int(round(elapsed[0] / 60))
         part2 = tr.studying_minute(count=mins)
         fin = tr.studying_finish()
         diag = askUserDialog(f"{part1} {part2}", [tr.studying_continue(), fin])
         diag.setIcon(QMessageBox.Information)
         if diag.run() == fin:
             return self.mw.moveToState("deckBrowser")
         self.mw.col.startTimebox()
     if self.cardQueue:
         # undone/edited cards to show
         c = self.cardQueue.pop()
         c.startTimer()
         self.hadCardQueue = True
     else:
         if self.hadCardQueue:
             # the undone/edited cards may be sitting in the regular queue;
             # need to reset
             self.mw.col.reset()
             self.hadCardQueue = False
         c = self.mw.col.sched.getCard()
     self.card = c
     if not c:
         self.mw.moveToState("overview")
         return
     if self._reps is None or self._reps % 100 == 0:
         # we recycle the webview periodically so webkit can free memory
         self._initWeb()
     self._showQuestion()
コード例 #2
0
 def check_timebox(self) -> bool:
     "True if answering should be aborted."
     elapsed = self.mw.col.timeboxReached()
     if elapsed:
         assert not isinstance(elapsed, bool)
         part1 = tr.studying_card_studied_in(count=elapsed[1])
         mins = int(round(elapsed[0] / 60))
         part2 = tr.studying_minute(count=mins)
         fin = tr.studying_finish()
         diag = askUserDialog(f"{part1} {part2}", [tr.studying_continue(), fin])
         diag.setIcon(QMessageBox.Icon.Information)
         if diag.run() == fin:
             self.mw.moveToState("deckBrowser")
             return True
         self.mw.col.startTimebox()
     return False