note type manager needs to ignore the default note type for current deck

This commit is contained in:
Damien Elmes 2013-01-08 21:39:37 +09:00
parent 9a22e13600
commit c335ea2cee
3 changed files with 5 additions and 5 deletions

View file

@ -227,9 +227,9 @@ crt=?, mod=?, scm=?, dty=?, usn=?, ls=?, conf=?""",
def noteCount(self):
return self.db.scalar("select count() from notes")
def newNote(self):
def newNote(self, forDeck=True):
"Return a new note with the current model."
return anki.notes.Note(self, self.models.current())
return anki.notes.Note(self, self.models.current(forDeck))
def addNote(self, note):
"Add a note to the collection. Return number of new cards."

View file

@ -100,10 +100,10 @@ class ModelManager(object):
# Retrieving and creating models
#############################################################
def current(self):
def current(self, forDeck=True):
"Get current model."
m = self.get(self.col.decks.current().get('mid'))
if not m:
if not forDeck or not m:
m = self.get(self.col.conf['curModel'])
return m or self.models.values()[0]

View file

@ -123,7 +123,7 @@ class Models(QDialog):
def _tmpNote(self):
self.mm.setCurrent(self.model)
n = self.col.newNote()
n = self.col.newNote(forDeck=False)
for name in n.keys():
n[name] = "("+name+")"
if "{{cloze:Text}}" in self.model['tmpls'][0]['qfmt']: