diff --git a/aqt/about.py b/aqt/about.py index c179684ea..c361d9e40 100644 --- a/aqt/about.py +++ b/aqt/about.py @@ -19,7 +19,7 @@ system. It's free and open source.") abouttext += '

' + _("Written by Damien Elmes, with patches, translation,\ testing and design from:

%(cont)s") % {'cont': u""" -Andreas Klauer, Andrew Wright, Bernhard Ibertsberger, Charlene +Alex Fraser, Andreas Klauer, Andrew Wright, Bernhard Ibertsberger, Charlene Barina, Christian Rusche, David Smith, Dave Druelinger, Dotan Cohen, Emilio Wuerges, Emmanuel Jarri, Frank Harper, H. Mijail, Ian Lewis, Iroiro, Jin Eun-Deok, Jarvik7, Jo Nakashima, Christian Krause, LaC, Laurent Steffan, Marco @@ -30,12 +30,8 @@ Petr Michalec, Piotr Kubowicz, Richard Colley, Samson Melamed, Stefaan De Pooter, Susanna Björverud, Tacutu, Timm Preetz, Timo Paulssen, Ursus, Victor Suba, and Xtru.

-Anki icon by Alex Fraser (CC GNU GPL)
-Deck icon: Be Box Icons (free for non-commercial use)
-Deck browser icons from:
-http://led24.de/iconset
-http://p.yusukekamiyamane.com/
-Other icons under LGPL or public domain.
+The icons were obtained from various sources; please see the Anki source +for credits. """ } diff --git a/aqt/browser.py b/aqt/browser.py index 0c24a81aa..9709e07e1 100644 --- a/aqt/browser.py +++ b/aqt/browser.py @@ -1447,7 +1447,7 @@ class BrowserToolbar(Toolbar): self.web.stdHtml(self._body % ( "", self._centerLinks(), - right), self._css, focus=False) + right), self._css) # Link handling ###################################################################### diff --git a/aqt/main.py b/aqt/main.py index 18f266e93..ca920eb18 100755 --- a/aqt/main.py +++ b/aqt/main.py @@ -292,7 +292,7 @@ background: #f3f3f3; margin: 2em; } h1 { margin-bottom: 0.2em; } -hr { margin:5 0 5 0; border:0; height:1px; background-color:#ccc; } +hr { background-color:#ccc; margin: 1em; } """ def button(self, link, name, key=None, class_="", id=""): diff --git a/aqt/overview.py b/aqt/overview.py index f2440de84..c59606091 100644 --- a/aqt/overview.py +++ b/aqt/overview.py @@ -43,7 +43,6 @@ class Overview(object): def _linkHandler(self, url): print "link", url if url == "study": - self.mw.col.reset() self.mw.moveToState("review") elif url == "anki": print "anki menu" diff --git a/aqt/reviewer.py b/aqt/reviewer.py index 6a6b28657..eaf16f7eb 100644 --- a/aqt/reviewer.py +++ b/aqt/reviewer.py @@ -33,7 +33,7 @@ class Reviewer(object): else: self.nextCard() self.keep = False - self.bottom.web.setFixedHeight(60) + self.bottom.web.setFixedHeight(46) self.bottom.web.setLinkHandler(self._linkHandler) def lastCard(self): @@ -82,12 +82,17 @@ var ankiPlatform = "desktop"; var hideq; var ans; var typeans; -function _updateQA (q) { +function _updateQA (q, answerMode) { $("#qa").html(q); typeans = document.getElementById("typeans"); if (typeans) { typeans.focus(); } + if (answerMode) { + window.location = "#answerStart"; + } else { + window.location = ""; + } }; function _showans (a) { $("#qa").html(a); @@ -117,15 +122,14 @@ function _typeAnsPress() { _showans(); } } -$(document).ready(function () { -$(".ansbut").focus(); -}); """ def _initWeb(self): + base = getBase(self.mw.col) self.web.stdHtml(self._revHtml, self._styles(), - bodyID="card", loadCB=lambda x: self._showQuestion()) + bodyID="card", loadCB=lambda x: self._showQuestion(), + head=base) # Showing the question ########################################################################## @@ -143,12 +147,12 @@ $(".ansbut").focus(); q = c.q() if self.mw.pm.profile['autoplay']: playFromText(q) - # render + # render & update bottom q = self._mungeQA(q) self.web.eval("_updateQA(%s);" % simplejson.dumps(q)) - runHook('showQuestion') - # and refresh bottom bar self._showAnswerButton() + # user hook + runHook('showQuestion') # Showing the answer ########################################################################## @@ -157,54 +161,16 @@ $(".ansbut").focus(); self.state = "answer" c = self.card a = c.a() + # play audio? if self.mw.pm.profile['autoplay']: playFromText(a) - # render + # render and update bottom + a = self._mungeQA(a) + self.web.eval("_updateQA(%s, true);" % simplejson.dumps(a)) + self._showEaseButtons() + # user hook runHook('showAnswer') - # Ease buttons - ########################################################################## - - def _defaultEase(self): - if self.mw.col.sched.answerButtons(self.card) == 4: - return 3 - else: - return 2 - - def _answerButtons(self): - if self.mw.col.sched.answerButtons(self.card) == 4: - labels = (_("Again"), _("Hard"), _("Good"), _("Easy")) - else: - labels = (_("Again"), _("Good"), _("Easy")) - times = [] - buttons = [] - default = self._defaultEase() - def but(label, i): - if i == default: - extra=" id=defease" - else: - extra = "" - return ''' -%s''' % (extra, i, label) - for i in range(0, len(labels)): - l = labels[i] - l += "
%s" % self._buttonTime(i, default-1) - buttons.append(but(l, i+1)) - buf = ("
" + - "".join(buttons) + "
") - return "

" + buf + "
" - return buf - - def _buttonTime(self, i, green): - if self.mw.pm.profile['showDueTimes']: - return "" - txt = self.mw.col.sched.nextIvlStr(self.card, i+1, True) - if i == 0: - txt = '%s' % txt - elif i == green: - txt = '%s' % txt - return txt - # Answering a card ############################################################ @@ -445,39 +411,90 @@ from(#fff), to(#ddd)); border-bottom: 0; border-top: 1px solid #aaa; margin: 0; -padding: 5px; +padding: 0px; +padding-left: 5px; padding-right: 5px; } td { font-weight: bold; font-size: 12px; } -.hitem { padding: 0; } -""" - _bottomQuestion = """ - - - - - - -
0 + 0 + 0 - -0:00
-
- - - - -
-Actions ▾    - - - -
+.hitem { margin-top: 2px; } +.stat { padding-top: 5px; } +.stattxt { padding-left: 5px; padding-right: 5px; } +.nobold { font-weight: normal; display: inline-block; padding-top: 3px; } +.spacer { height: 18px; } +.spacer2 { height: 16px; } +button { font-weight: normal; } """ + def _bottomHTML(self, middle): + return """ + + + + + + +
1 + 7 + 3
+
+%(middle)s +0:53
+ +
+ +""" % dict(middle=middle) + def _showAnswerButton(self): + self.bottom.web.setFocus() + middle = ''' +
+''' % _("Show Answer") + # wrap it in a table so it has the same top margin as the ease buttons + middle = "
%s
" % middle self.bottom.web.stdHtml( - self._bottomQuestion % _("Show Answer"), + self._bottomHTML(middle), self.bottom._css + self._bottomCSS) + def _showEaseButtons(self): + print self._answerButtons() + self.bottom.web.stdHtml( + self._bottomHTML(self._answerButtons()), + self.bottom._css + self._bottomCSS) + + def _defaultEase(self): + if self.mw.col.sched.answerButtons(self.card) == 4: + return 3 + else: + return 2 + + def _answerButtons(self): + if self.mw.col.sched.answerButtons(self.card) == 4: + labels = (_("Again"), _("Hard"), _("Good"), _("Easy")) + else: + labels = (_("Again"), _("Good"), _("Easy")) + times = [] + buttons = [] + default = self._defaultEase() + def but(label, i): + if i == default: + extra = "id=defease" + else: + extra = "" + due = self._buttonTime(i-1, default-1) + return ''' +%s''' % (due, extra, i, label) + buf = "
" + for i in range(0, len(labels)): + buf += but(labels[i], i+1) + buf += "
" + script = """ +""" + return buf + script + + def _buttonTime(self, i, green): + if not self.mw.pm.profile['showDueTimes']: + return "
" + txt = self.mw.col.sched.nextIvlStr(self.card, i+1, True) + return '%s
' % txt + # Status bar ########################################################################## diff --git a/aqt/toolbar.py b/aqt/toolbar.py index bf6e3aa1c..f9b4477f8 100644 --- a/aqt/toolbar.py +++ b/aqt/toolbar.py @@ -20,7 +20,7 @@ class Toolbar(object): ' '*20, self._centerLinks(), self._rightIcons()), - self._css, focus=False) + self._css) # Available links ###################################################################### @@ -62,7 +62,11 @@ class Toolbar(object): elif l == "decks": self.mw.moveToState("deckBrowser") elif l == "study": - self.mw.onOverview() + # if overview already shown, switch to review + if self.mw.state == "overview": + self.mw.moveToState("review") + else: + self.mw.onOverview() elif l == "add": self.mw.onAddCard() elif l == "browse": diff --git a/aqt/webview.py b/aqt/webview.py index 16ee77a2c..6a0e3ab57 100644 --- a/aqt/webview.py +++ b/aqt/webview.py @@ -83,16 +83,14 @@ class AnkiWebView(QWebView): if loadCB: self._loadFinishedCB = loadCB QWebView.setHtml(self, html) - def stdHtml(self, body, css="", bodyID="", loadCB=None, focus=True): + def stdHtml(self, body, css="", bodyID="", loadCB=None, head=""): self.setHtml(""" +%s %s""" % ( - css, anki.js.all, bodyID, body), loadCB) - # ensure we're focused - if focus: - self.setFocus() + css, anki.js.all, head, bodyID, body), loadCB) def setBridge(self, bridge): self._bridge.setBridge(bridge) def eval(self, js): diff --git a/designer/icons.qrc b/designer/icons.qrc index a2e4f6cb3..741ca2e6a 100644 --- a/designer/icons.qrc +++ b/designer/icons.qrc @@ -2,26 +2,21 @@ icons/arrow-up.png icons/arrow-down.png - icons/blue.png icons/gears.png - icons/both.png icons/green.png icons/clock-icon.png icons/plus-circle.png icons/none.png icons/edit-find 2.png icons/edit-find-replace.png - icons/graphite_smooth_folder_noncommercial.png icons/user-identity.png icons/layout.png - icons/generate_07.png icons/view-sort-descending.png icons/view-refresh.png icons/emblem-important.png icons/view-sort-ascending.png icons/media-playback-start2.png icons/anki-logo-thin.png - icons/anki-logo.png icons/download.png icons/preferences-plugin.png icons/system-software-update.png @@ -43,34 +38,22 @@ icons/anki-tag.png icons/edit-redo.png icons/text-xml.png - icons/document-preview.png icons/media-record.png icons/edit-rename.png icons/kblogger.png - icons/chronometer.png - icons/Anki_Card.png - icons/document-open-remote.png - icons/document-open-recent.png icons/khtml_kget.png icons/edit-find.png icons/colors.png icons/anki.png icons/Anki_Add_Tag.png - icons/Anki_Card.png icons/Anki_Del_Tag.png - icons/Anki_Fact.png icons/application-exit.png - icons/colorscm.png icons/configure.png icons/contents.png icons/contents2.png icons/document-export.png icons/document-import.png icons/document-new.png - icons/document-open-recent.png - icons/document-open.png - icons/document-save-as.png - icons/document-save.png icons/edit-undo.png icons/edit.png icons/editdelete.png @@ -79,11 +62,9 @@ icons/folder_sound.png icons/format-stroke-color.png icons/games-solve.png - icons/go-home.png icons/help-contents.png icons/help.png icons/image.png - icons/kanji.png icons/kbugbuster.png icons/kexi.png icons/kpersonalizer.png @@ -93,7 +74,6 @@ icons/media-playback-pause.png icons/media-playback-start.png icons/media-playback-stop.png - icons/multisynk.png icons/package_games_card.png icons/preferences-desktop-font.png icons/rating.png diff --git a/designer/icons/Anki_Card.png b/designer/icons/Anki_Card.png deleted file mode 100644 index 7f979a23c..000000000 Binary files a/designer/icons/Anki_Card.png and /dev/null differ diff --git a/designer/icons/Anki_Fact.png b/designer/icons/Anki_Fact.png deleted file mode 100644 index 1870c5a7e..000000000 Binary files a/designer/icons/Anki_Fact.png and /dev/null differ diff --git a/designer/icons/anki-logo.png b/designer/icons/anki-logo.png deleted file mode 100644 index 8592de563..000000000 Binary files a/designer/icons/anki-logo.png and /dev/null differ diff --git a/designer/icons/appointment-new.png b/designer/icons/appointment-new.png deleted file mode 100644 index fd225f4b7..000000000 Binary files a/designer/icons/appointment-new.png and /dev/null differ diff --git a/designer/icons/blue.png b/designer/icons/blue.png deleted file mode 100644 index b95c96777..000000000 Binary files a/designer/icons/blue.png and /dev/null differ diff --git a/designer/icons/both.png b/designer/icons/both.png deleted file mode 100644 index 817dc3b82..000000000 Binary files a/designer/icons/both.png and /dev/null differ diff --git a/designer/icons/chronometer.png b/designer/icons/chronometer.png deleted file mode 100644 index 00386b705..000000000 Binary files a/designer/icons/chronometer.png and /dev/null differ diff --git a/designer/icons/colorscm.png b/designer/icons/colorscm.png deleted file mode 100644 index 5c6638671..000000000 Binary files a/designer/icons/colorscm.png and /dev/null differ diff --git a/designer/icons/document-open-recent.png b/designer/icons/document-open-recent.png deleted file mode 100644 index 2d16f7928..000000000 Binary files a/designer/icons/document-open-recent.png and /dev/null differ diff --git a/designer/icons/document-open-remote.png b/designer/icons/document-open-remote.png deleted file mode 100644 index 5816ea725..000000000 Binary files a/designer/icons/document-open-remote.png and /dev/null differ diff --git a/designer/icons/document-open.png b/designer/icons/document-open.png deleted file mode 100644 index 7422ad333..000000000 Binary files a/designer/icons/document-open.png and /dev/null differ diff --git a/designer/icons/document-preview.png b/designer/icons/document-preview.png deleted file mode 100644 index 161174002..000000000 Binary files a/designer/icons/document-preview.png and /dev/null differ diff --git a/designer/icons/document-save-as.png b/designer/icons/document-save-as.png deleted file mode 100644 index 9695a5642..000000000 Binary files a/designer/icons/document-save-as.png and /dev/null differ diff --git a/designer/icons/document-save.png b/designer/icons/document-save.png deleted file mode 100644 index 7fa489c0f..000000000 Binary files a/designer/icons/document-save.png and /dev/null differ diff --git a/designer/icons/generate_07.png b/designer/icons/generate_07.png deleted file mode 100644 index afd3c0d5d..000000000 Binary files a/designer/icons/generate_07.png and /dev/null differ diff --git a/designer/icons/go-home.png b/designer/icons/go-home.png deleted file mode 100644 index b16c19f26..000000000 Binary files a/designer/icons/go-home.png and /dev/null differ diff --git a/designer/icons/graphite_smooth_folder_noncommercial.png b/designer/icons/graphite_smooth_folder_noncommercial.png deleted file mode 100644 index 49ca50d85..000000000 Binary files a/designer/icons/graphite_smooth_folder_noncommercial.png and /dev/null differ diff --git a/designer/icons/kanji.png b/designer/icons/kanji.png deleted file mode 100644 index 77c5a26f2..000000000 Binary files a/designer/icons/kanji.png and /dev/null differ diff --git a/designer/icons/multisynk.png b/designer/icons/multisynk.png deleted file mode 100644 index e5262bda1..000000000 Binary files a/designer/icons/multisynk.png and /dev/null differ diff --git a/designer/icons/sources.txt b/designer/icons/sources.txt new file mode 100644 index 000000000..9fdaab34c --- /dev/null +++ b/designer/icons/sources.txt @@ -0,0 +1,9 @@ +-Anki icon by Alex Fraser (CC GNU GPL) +-Deck icon: Be Box Icons (non-commercial use) +-Deck due/new icons from: + http://led24.de/iconset + http://p.yusukekamiyamane.com/ +-Other icons obtained from KDE themes (GPL/LGPL) + +Note that some of the icons have been modified to fit in with Anki better +(grayscaled, cropped, etc).