mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 06:22:22 -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):
|
def noteCount(self):
|
||||||
return self.db.scalar("select count() from notes")
|
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 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):
|
def addNote(self, note):
|
||||||
"Add a note to the collection. Return number of new cards."
|
"Add a note to the collection. Return number of new cards."
|
||||||
|
|
|
@ -100,10 +100,10 @@ class ModelManager(object):
|
||||||
# Retrieving and creating models
|
# Retrieving and creating models
|
||||||
#############################################################
|
#############################################################
|
||||||
|
|
||||||
def current(self):
|
def current(self, forDeck=True):
|
||||||
"Get current model."
|
"Get current model."
|
||||||
m = self.get(self.col.decks.current().get('mid'))
|
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'])
|
m = self.get(self.col.conf['curModel'])
|
||||||
return m or self.models.values()[0]
|
return m or self.models.values()[0]
|
||||||
|
|
||||||
|
|
|
@ -123,7 +123,7 @@ class Models(QDialog):
|
||||||
|
|
||||||
def _tmpNote(self):
|
def _tmpNote(self):
|
||||||
self.mm.setCurrent(self.model)
|
self.mm.setCurrent(self.model)
|
||||||
n = self.col.newNote()
|
n = self.col.newNote(forDeck=False)
|
||||||
for name in n.keys():
|
for name in n.keys():
|
||||||
n[name] = "("+name+")"
|
n[name] = "("+name+")"
|
||||||
if "{{cloze:Text}}" in self.model['tmpls'][0]['qfmt']:
|
if "{{cloze:Text}}" in self.model['tmpls'][0]['qfmt']:
|
||||||
|
|
Loading…
Reference in a new issue