diff --git a/ankiqt/ui/main.py b/ankiqt/ui/main.py index 22b168456..af2320f8e 100644 --- a/ankiqt/ui/main.py +++ b/ankiqt/ui/main.py @@ -951,11 +951,18 @@ To upgrade an old deck, download Anki 0.9.8.7.""")) lambda: QDesktopServices.openUrl(QUrl( ankiqt.appWiki + "StudyOptions"))) self.mainWin.optionsBox.setShown(False) + self.connect(self.mainWin.minuteLimit, + SIGNAL("textChanged(QString)"), self.onMinuteLimitChanged) - def showStudyScreen(self): - self.mainWin.optionsButton.setChecked(self.config['showStudyOptions']) - self.mainWin.optionsBox.setShown(self.config['showStudyOptions']) - self.switchToStudyScreen() + def onMinuteLimitChanged(self, qstr): + try: + self.deck.sessionTimeLimit = float( + self.mainWin.minuteLimit.text()) * 60 + except ValueError: + pass + self.updateStudyStats() + + def updateStudyStats(self): initial = self.deck.sessionStartTime == 0 if initial: # deck just opened, or screen triggered manually @@ -967,9 +974,9 @@ To upgrade an old deck, download Anki 0.9.8.7.""")) # top label h = {} s = self.deck.getStats() - h['lapsed'] = '%s' % s['failed'] - h['ret'] = s['rev'] + h['ret'] = '%s' % (s['rev']+s['failed']) h['new'] = '%s' % s['new'] + h['newof'] = '%s' % self.deck.newCount dtoday = s['dTotal'] yesterday = self.deck._dailyStats.day - datetime.timedelta(1) res = self.deck.s.first(""" @@ -979,15 +986,11 @@ day = :d""", d=yesterday) (dyest, tyest) = res else: dyest = 0; tyest = 0 - dchange = dtoday - dyest - if dchange >= 0: - dchange = "+%d" % dchange - else: - dchange = str(dchange) h['repsToday'] = '%s' % dtoday - h['repsTodayChg'] = '(%s)' % dchange - start = self.deck.sessionStartTime or time.time() - 600 - start2 = self.deck.lastSessionStart or start - 600 + h['repsTodayChg'] = '%s' % dyest + limit = self.deck.sessionTimeLimit + start = self.deck.sessionStartTime or time.time() - limit + start2 = self.deck.lastSessionStart or start - limit last10 = self.deck.s.scalar( "select count(*) from reviewHistory where time >= :t", t=start) @@ -995,39 +998,38 @@ day = :d""", d=yesterday) "select count(*) from reviewHistory where " "time >= :t and time < :t2", t=start2, t2=start) - change = last10 - last20 - if change >= 0: - change = "+%d" % change - else: - change = str(change) - h['repsIn10'] = '%s' % last10 - h['repsIn10Chg'] = '(%s)' % change + h['repsInSes'] = '%s' % last10 + h['repsInSesChg'] = '%s' % last20 ttoday = s['dReviewTime'] - change = ttoday - tyest - if change >= 0: - change = "+%s" % anki.utils.fmtTimeSpan(change, short=True, point=1) - else: - change = anki.utils.fmtTimeSpan(change, short=True, point=1) h['timeToday'] = '%s' % ( anki.utils.fmtTimeSpan(ttoday, short=True, point=1)) - h['timeTodayChg'] = '(%s)' % change + h['timeTodayChg'] = '%s' % ( + anki.utils.fmtTimeSpan(tyest, short=True, point=1)) self.mainWin.optionsLabel.setText(top + _("""\

- - - - - - - +
Reps (10 mins):  %(repsIn10)s%(repsIn10Chg)s
Reps (today):%(repsToday)s%(repsTodayChg)s
Time (today):%(timeToday)s     %(timeTodayChg)s
+ + + + + +
Session:  %(repsInSes)s%(repsInSesChg)s
Day:%(repsToday)s%(repsTodayChg)s
Time:%(timeToday)s%(timeTodayChg)s
- - - + + +
Failed:%(lapsed)s
Review:   %(ret)s
New:%(new)s
Review: %(ret)s
New today:%(new)s
New total:%(newof)s
""") % h) + + + def showStudyScreen(self): + initial = self.deck.sessionStartTime == 0 + self.mainWin.optionsButton.setChecked(self.config['showStudyOptions']) + self.mainWin.optionsBox.setShown(self.config['showStudyOptions']) + self.switchToStudyScreen() + self.updateStudyStats() # start reviewing button self.mainWin.buttonStack.setCurrentIndex(3) self.mainWin.buttonStack.show() @@ -1044,7 +1046,7 @@ day = :d""", d=yesterday) def setupStudyOptions(self): self.mainWin.newPerDay.setText(str(self.deck.newCardsPerDay)) - self.mainWin.minuteLimit.setText(str(self.deck.sessionTimeLimit/60.0)) + self.mainWin.minuteLimit.setText(str(self.deck.sessionTimeLimit/60)) self.mainWin.questionLimit.setText(str(self.deck.sessionRepLimit)) self.mainWin.newCardOrder.setCurrentIndex(self.deck.newCardOrder) self.mainWin.newCardScheduling.setCurrentIndex(self.deck.newCardSpacing) diff --git a/designer/main.ui b/designer/main.ui index a81a7b430..f9e41a7b9 100644 --- a/designer/main.ui +++ b/designer/main.ui @@ -6,7 +6,7 @@ 0 0 536 - 453 + 450 @@ -28,7 +28,7 @@ 0 69 536 - 364 + 361 @@ -155,7 +155,7 @@ 0 0 251 - 305 + 302 @@ -208,7 +208,7 @@ 0 0 251 - 305 + 302 @@ -216,6 +216,9 @@ + + 0 + 4 @@ -224,6 +227,9 @@ <h1>Welcome!</h1> + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + @@ -237,53 +243,201 @@ 20 - 10 + 6 + + + + + 400 + 16777215 + + + + Qt::Horizontal + + + + + + + + + + true + + + + 0 + + + + + 2 + + + 0 + + + + + + 90 + 0 + + + + <b>Minute limit:</b> + + + + + + + + 0 + 0 + + + + + 50 + 16777215 + + + + + + + + <b>Question limit:</b> + + + + + + + + 0 + 0 + + + + + 50 + 16777215 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 90 + 0 + + + + <b>New per day:</b> + + + + + + + + 0 + 0 + + + + + 50 + 16777215 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Preferred + + + + 10 + 20 + + + + + + + + + + + + More>> + + + true + + + false + + + false + + + + + + + Help + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + - - - - - - &Options>> - - - true - - - false - - - false - - - - - - - Help - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - @@ -295,135 +449,42 @@ + + true + + + 0 + - - - 2 + + + + 400 + 16777215 + - - 0 + + + + + + + 400 + 16777215 + - - - - - 90 - 0 - - - - Time limit (mins): - - - - - - - - 0 - 0 - - - - - 50 - 16777215 - - - - - - - - Question limit: - - - - - - - - 0 - 0 - - - - - 50 - 16777215 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 90 - 0 - - - - New per day - - - - - - - - 0 - 0 - - - - - 50 - 16777215 - - - - - - - - Qt::Horizontal - - - QSizePolicy::Preferred - - - - 10 - 20 - - - - - + - - - - - - - + + + + 400 + 16777215 + + + @@ -481,8 +542,8 @@ 0 0 - 428 - 66 + 251 + 53 @@ -522,8 +583,8 @@ 0 0 - 428 - 66 + 251 + 53 @@ -672,8 +733,8 @@ 0 0 - 428 - 66 + 251 + 53 @@ -707,8 +768,8 @@ 0 0 - 428 - 66 + 251 + 53 @@ -749,8 +810,8 @@ 0 0 - 428 - 66 + 251 + 53 @@ -1135,7 +1196,7 @@ 0 - 433 + 430 536 20 @@ -1734,21 +1795,21 @@ easeButton2 easeButton3 easeButton4 + newPerDay + minuteLimit questionLimit + optionsButton + optionsHelpButton newCardOrder newCardScheduling revCardOrder delayLapsedCards - optionsHelpButton - newPerDay - optionsButton - minuteLimit - saveEditorButton - help - welcomeText startReviewingButton showAnswerButton typeAnswerField + help + saveEditorButton + welcomeText @@ -1761,12 +1822,12 @@ setShown(bool) - 98 - 134 + 87 + 219 - 219 - 190 + 211 + 344