mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 06:22:22 -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."),
|
"The first field is empty."),
|
||||||
help="AddItems#AddError")
|
help="AddItems#AddError")
|
||||||
return
|
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)
|
cards = self.mw.col.addNote(note)
|
||||||
if not cards:
|
if not cards:
|
||||||
showWarning(_("""\
|
showWarning(_("""\
|
||||||
|
|
|
@ -10,7 +10,7 @@ from anki.hooks import runHook, runFilter
|
||||||
from aqt.sound import getAudio
|
from aqt.sound import getAudio
|
||||||
from aqt.webview import AnkiWebView
|
from aqt.webview import AnkiWebView
|
||||||
from aqt.utils import shortcut, showInfo, showWarning, getBase, getFile, \
|
from aqt.utils import shortcut, showInfo, showWarning, getBase, getFile, \
|
||||||
openHelp
|
openHelp, tooltip
|
||||||
import aqt
|
import aqt
|
||||||
import anki.js
|
import anki.js
|
||||||
from BeautifulSoup import BeautifulSoup
|
from BeautifulSoup import BeautifulSoup
|
||||||
|
@ -754,9 +754,8 @@ class Editor(object):
|
||||||
# check that the model is set up for cloze deletion
|
# check that the model is set up for cloze deletion
|
||||||
if '{{cloze:' not in self.note.model()['tmpls'][0]['qfmt']:
|
if '{{cloze:' not in self.note.model()['tmpls'][0]['qfmt']:
|
||||||
if self.addMode:
|
if self.addMode:
|
||||||
showInfo(_("""\
|
tooltip(_("Warning, cloze deletions will not work until "
|
||||||
To use this button, please select the Cloze note type. To learn more, \
|
"you switch the type at the top to Cloze."))
|
||||||
please click the help button."""), help="cloze")
|
|
||||||
else:
|
else:
|
||||||
showInfo(_("""\
|
showInfo(_("""\
|
||||||
To make a cloze deletion on an existing note, you need to change it \
|
To make a cloze deletion on an existing note, you need to change it \
|
||||||
|
|
Loading…
Reference in a new issue