Skip to content

Commit

Permalink
mark last answer button plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
dae committed Jul 5, 2010
1 parent 16123c9 commit 5f1ea00
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions showlastans.py
@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
# Copyright: Damien Elmes <anki@ichi2.net>
# License: GNU GPL, version 3 or later; http://www.gnu.org/copyleft/gpl.html
#
# Marks the previous answer button like '*Again*'
# Sponsored by Alan Clontz.
#

from PyQt4.QtCore import *
from PyQt4.QtGui import *
from ankiqt import mw, ui
from anki.hooks import wrap
import os,re

def showLast():
lastEase = mw.deck.s.scalar("""
select ease from reviewHistory where cardId = :id
order by time desc limit 1""", id=mw.currentCard.id)
# make sure ease1 is reset
mw.mainWin.easeButton1.setText(_("Again"))
if lastEase:
but = getattr(mw.mainWin, "easeButton%d" % lastEase)
but.setText("*%s*" % but.text())

mw.showEaseButtons = wrap(mw.showEaseButtons, showLast)

0 comments on commit 5f1ea00

Please sign in to comment.