mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
cloze deletion tweaks (#601)
- allow creation of cloze deletion when note type not selected; warn with tooltip. prevents selection from getting lost - warn before adding cloze note type with no deletions
This commit is contained in:
parent
205c6d4c38
commit
ebba215a9a
2 changed files with 10 additions and 5 deletions
|
@ -131,6 +131,12 @@ class AddCards(QDialog):
|
|||
"The first field is empty."),
|
||||
help="AddItems#AddError")
|
||||
return
|
||||
if '{{cloze:' in note.model()['tmpls'][0]['qfmt']:
|
||||
if not self.mw.col.models._availClozeOrds(
|
||||
note.model(), note.joinedFields(), False):
|
||||
if not askUser(_("You have a cloze deletion note type "
|
||||
"but have not made any cloze deletions. Proceed?")):
|
||||
return
|
||||
cards = self.mw.col.addNote(note)
|
||||
if not cards:
|
||||
showWarning(_("""\
|
||||
|
|
|
@ -10,7 +10,7 @@ from anki.hooks import runHook, runFilter
|
|||
from aqt.sound import getAudio
|
||||
from aqt.webview import AnkiWebView
|
||||
from aqt.utils import shortcut, showInfo, showWarning, getBase, getFile, \
|
||||
openHelp
|
||||
openHelp, tooltip
|
||||
import aqt
|
||||
import anki.js
|
||||
from BeautifulSoup import BeautifulSoup
|
||||
|
@ -754,14 +754,13 @@ class Editor(object):
|
|||
# check that the model is set up for cloze deletion
|
||||
if '{{cloze:' not in self.note.model()['tmpls'][0]['qfmt']:
|
||||
if self.addMode:
|
||||
showInfo(_("""\
|
||||
To use this button, please select the Cloze note type. To learn more, \
|
||||
please click the help button."""), help="cloze")
|
||||
tooltip(_("Warning, cloze deletions will not work until "
|
||||
"you switch the type at the top to Cloze."))
|
||||
else:
|
||||
showInfo(_("""\
|
||||
To make a cloze deletion on an existing note, you need to change it \
|
||||
to a cloze type first, via Edit>Change Note Type."""))
|
||||
return
|
||||
return
|
||||
# find the highest existing cloze
|
||||
highest = 0
|
||||
for name, val in self.note.items():
|
||||
|
|
Loading…
Reference in a new issue