add type-in-the-answer note type

This commit is contained in:
Damien Elmes 2017-08-13 19:41:26 +10:00
parent c8127ee606
commit a353135af3
2 changed files with 21 additions and 1 deletions

View File

@ -26,6 +26,25 @@ def addBasicModel(col):
models.append((lambda: _("Basic"), addBasicModel))
# Basic w/ typing
##########################################################################
def addBasicTypingModel(col):
mm = col.models
m = mm.new(_("Basic (type in the answer)"))
fm = mm.newField(_("Front"))
mm.addField(m, fm)
fm = mm.newField(_("Back"))
mm.addField(m, fm)
t = mm.newTemplate(_("Card 1"))
t['qfmt'] = "{{"+_("Front")+"}}\n{{type:"+_("Back")+"}}"
t['afmt'] = "{{FrontSide}}\n\n<hr id=answer>\n\n"+"{{"+_("Back")+"}}"
mm.addTemplate(m, t)
mm.add(m)
return m
models.append((lambda: _("Basic (type in the answer)"), addBasicTypingModel))
# Forward & Reverse
##########################################################################

View File

@ -11,7 +11,7 @@ from anki.db import DB
from anki.collection import _Collection
from anki.consts import *
from anki.stdmodels import addBasicModel, addClozeModel, addForwardReverse, \
addForwardOptionalReverse
addForwardOptionalReverse, addBasicTypingModel
def Collection(path, lock=True, server=False, sync=True, log=False):
"Open a new or existing collection. Path must be unicode."
@ -43,6 +43,7 @@ def Collection(path, lock=True, server=False, sync=True, log=False):
elif create:
# add in reverse order so basic is default
addClozeModel(col)
addBasicTypingModel(col)
addForwardOptionalReverse(col)
addForwardReverse(col)
addBasicModel(col)