mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
note type manager needs to ignore the default note type for current deck
This commit is contained in:
parent
9a22e13600
commit
c335ea2cee
3 changed files with 5 additions and 5 deletions
|
@ -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."
|
||||
|
|
|
@ -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]
|
||||
|
||||
|
|
|
@ -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']:
|
||||
|
|
Loading…
Reference in a new issue