diff --git a/ankiqt/ui/main.py b/ankiqt/ui/main.py index 5c9cbecf5..1dab2de5b 100755 --- a/ankiqt/ui/main.py +++ b/ankiqt/ui/main.py @@ -15,7 +15,7 @@ from PyQt4.QtGui import * from anki import DeckStorage from anki.errors import * from anki.sound import hasSound, playFromText, clearAudioQueue -from anki.utils import addTags, deleteTags, parseTags, canonifyTags +from anki.utils import addTags, deleteTags, parseTags, canonifyTags, stripHTML from anki.media import rebuildMediaDir from anki.db import OperationalError, SessionHelper from anki.stdmodels import BasicModel @@ -115,6 +115,14 @@ class AnkiQt(QMainWindow): self.connect(self.mainWin.reviewEarlyButton, SIGNAL("clicked()"), self.onReviewEarly) + # notices + self.mainWin.noticeFrame.setShown(False) + self.connect(self.mainWin.noticeButton, SIGNAL("clicked()"), + lambda: self.mainWin.noticeFrame.setShown(False)) + + def setNotice(self, str): + self.mainWin.noticeLabel.setText(str) + self.mainWin.noticeFrame.setShown(True) def setupViews(self): self.bodyView = ui.view.View(self, self.mainWin.mainText, @@ -414,6 +422,8 @@ Please do not file a bug report with Anki.
""") self.deck.s.expunge(self.currentCard) # answer self.deck.answerCard(self.currentCard, quality) + if self.currentCard.reps > 15 and self.currentCard.successive == 0: + self.handleLeech() self.lastScheduledTime = anki.utils.fmtTimeSpan( self.currentCard.due - time.time()) self.lastQuality = quality @@ -426,6 +436,21 @@ Please do not file a bug report with Anki.
""") self.save() self.moveToState("getQuestion") + def handleLeech(self): + self.deck.refresh() + tags = self.currentCard.fact.tags + tags = addTags("Suspended", tags) + tags = addTags("Leech", tags) + self.currentCard.fact.tags = canonifyTags(tags) + self.currentCard.fact.setModified(textChanged=True) + self.deck.updateFactTags([self.currentCard.fact.id]) + for card in self.currentCard.fact.cards: + self.deck.updatePriority(card) + self.deck.refresh() + self.setNotice(_("""\ +%s... was a leech.""") % + stripHTML(self.currentCard.question)[0:30]) + def startRefreshTimer(self): "Update the screen once a minute until next card is displayed." if getattr(self, 'refreshTimer', None): @@ -2079,15 +2104,10 @@ it to your friends. setCurrentIndex(1) def noSyncResponse(self): - msg = _("""\ -

Sync Failed

-Couldn't contact Anki Online. Please check your internet connection.""") + msg = _("Sync Failed. Please check your internet connection.") if self.config['proxyHost']: - msg += _(" Also check your proxy settings.") - if self.config['syncInMsgBox']: - ui.utils.showWarning(msg) - else: - self.showToolTip(msg) + msg += _(" (and proxy settings)") + self.setNotice(msg) def openSyncProgress(self): self.syncProgressDialog = QProgressDialog(_("Syncing Media..."), diff --git a/ankiqt/ui/status.py b/ankiqt/ui/status.py index 9ef6d4929..823d93fd8 100644 --- a/ankiqt/ui/status.py +++ b/ankiqt/ui/status.py @@ -304,4 +304,3 @@ You should aim to answer each question within
def setTimer(self, txt): self.timer.setText("" + txt + " ") - diff --git a/designer/main.ui b/designer/main.ui index e71f754ad..48a80849a 100644 --- a/designer/main.ui +++ b/designer/main.ui @@ -6,8 +6,8 @@ 0 0 - 696 - 655 + 538 + 537 @@ -51,21 +51,15 @@ QFrame::Raised - - - 0 - + 0 - - - - - 0 - 1 - - + + 0 + + + @@ -78,6 +72,78 @@ + + + + 255 + 253 + 215 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 254 + 235 + + + + + + + 127 + 126 + 107 + + + + + + + 170 + 169 + 143 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + @@ -88,11 +154,47 @@ + + + 255 + 253 + 215 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 254 + 235 + + + + 255 255 - 255 + 220 + + + + + + + 0 + 0 + 0 @@ -107,6 +209,78 @@ + + + + 255 + 253 + 215 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 254 + 235 + + + + + + + 127 + 126 + 107 + + + + + + + 170 + 169 + 143 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + @@ -117,11 +291,47 @@ + + + 255 + 253 + 215 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 254 + 235 + + + + 255 255 - 255 + 220 + + + + + + + 0 + 0 + 0 @@ -130,9 +340,81 @@ - 128 - 128 - 128 + 127 + 126 + 107 + + + + + + + 255 + 253 + 215 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 254 + 235 + + + + + + + 127 + 126 + 107 + + + + + + + 170 + 169 + 143 + + + + + + + 127 + 126 + 107 + + + + + + + 255 + 255 + 255 + + + + + + + 127 + 126 + 107 @@ -140,17 +422,53 @@ 255 - 255 - 255 + 253 + 215 + + + 255 + 253 + 215 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 253 + 215 + + + + 255 255 - 255 + 220 + + + + + + + 0 + 0 + 0 @@ -160,224 +478,66 @@ true - - 3 + + QFrame::NoFrame - - - - 0 - - - 8 - - - 4 - - - 8 - - - 4 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - - 0 - 41 - - - - Show the answer (shortcut key: space or enter) - - - Show Answer - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - 0 - - - 4 - - - 0 - - - 4 - - - - - - - Qt::Horizontal - - - - 40 - 0 - - - - - - - - 4 - - - 4 - - - 0 - - - - - - - - Qt::AlignCenter - - - - - - - - - - Qt::AlignCenter - - - - - - - - - - Qt::AlignCenter - - - - - - - - - - Qt::AlignCenter - - - - - - - Show this card again soon (shortcut key: 1) - - - Again - - - - - - - Wait a little longer next time (shortcut key: 2) - - - Hard - - - - - - - Wait longer next time (shortcut key: 3) - - - Good - - - - - - - Wait a lot longer next time (shortcut key: 4) - - - Easy - - - - - - - - - Qt::Horizontal - - - - 40 - 0 - - - - - - - - - - + + QFrame::Plain + + + + 12 + + + 8 + + + 6 + + + + + + 0 + 0 + + + + + 10 + + + + TextLabel + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + true + + + true + + + + + + + + 0 + 0 + + + + X + + + + - + @@ -1285,6 +1445,325 @@ + + + + + 0 + 1 + + + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 128 + 128 + 128 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + true + + + 3 + + + + + 0 + + + 8 + + + 4 + + + 8 + + + 4 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 0 + 41 + + + + Show the answer (shortcut key: space or enter) + + + Show Answer + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + 0 + + + 4 + + + 0 + + + 4 + + + + + + + Qt::Horizontal + + + + 40 + 0 + + + + + + + + 4 + + + 4 + + + 0 + + + + + + + + Qt::AlignCenter + + + + + + + + + + Qt::AlignCenter + + + + + + + + + + Qt::AlignCenter + + + + + + + + + + Qt::AlignCenter + + + + + + + Show this card again soon (shortcut key: 1) + + + Again + + + + + + + Wait a little longer next time (shortcut key: 2) + + + Hard + + + + + + + Wait longer next time (shortcut key: 3) + + + Good + + + + + + + Wait a lot longer next time (shortcut key: 4) + + + Easy + + + + + + + + + Qt::Horizontal + + + + 40 + 0 + + + + + + + + + + + + @@ -1321,34 +1800,412 @@ + + + + 0 + 0 + 0 + + + + + + + 255 + 253 + 215 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 254 + 235 + + + + + + + 127 + 126 + 107 + + + + + + + 170 + 169 + 143 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + 255 - 250 - 230 + 253 + 215 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 254 + 235 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + 255 + 253 + 215 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 254 + 235 + + + + + + + 127 + 126 + 107 + + + + + + + 170 + 169 + 143 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + 255 - 250 - 230 + 253 + 215 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 254 + 235 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + 127 + 126 + 107 + + + + + + + 255 + 253 + 215 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 254 + 235 + + + + + + + 127 + 126 + 107 + + + + + + + 170 + 169 + 143 + + + + + + + 127 + 126 + 107 + + + + + + + 255 + 255 + 255 + + + + + + + 127 + 126 + 107 + + + + + + + 255 + 253 + 215 + + + - 207 - 207 - 207 + 255 + 253 + 215 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 253 + 215 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 @@ -1397,6 +2254,60 @@ + + + + 0 + 0 + 0 + + + + + + + 255 + 253 + 215 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 254 + 235 + + + + + + + 127 + 126 + 107 + + + + + + + 170 + 169 + 143 + + + @@ -1406,17 +2317,134 @@ + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + 255 - 250 - 230 + 253 + 215 + + + + + + + 255 + 253 + 215 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 254 + 235 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + 255 + 253 + 215 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 254 + 235 + + + + + + + 127 + 126 + 107 + + + + + + + 170 + 169 + 143 + + + @@ -1426,38 +2454,221 @@ + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + 255 - 250 - 230 + 253 + 215 + + + + + + + 255 + 253 + 215 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 254 + 235 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + 127 + 126 + 107 + + + + + + + 255 + 253 + 215 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 254 + 235 + + + + + + + 127 + 126 + 107 + + + + + + + 170 + 169 + 143 + + + - 165 - 164 - 164 + 127 + 126 + 107 + + + + + + + 255 + 255 + 255 + + + + + + + 127 + 126 + 107 - 207 - 207 - 207 + 255 + 253 + 215 + + + + + + + 255 + 253 + 215 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 253 + 215 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + true + QFrame::NoFrame @@ -1482,7 +2693,7 @@ 0 0 - 696 + 538 23