mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 14:32:22 -04:00
fix cloze
This commit is contained in:
parent
b812b50ee3
commit
1bcc8b9d27
5 changed files with 4 additions and 209 deletions
|
@ -536,13 +536,8 @@ class Editor(object):
|
||||||
|
|
||||||
def onCloze(self):
|
def onCloze(self):
|
||||||
# check that the model is set up for cloze deletion
|
# check that the model is set up for cloze deletion
|
||||||
ok = False
|
if 'cloze' not in self.note.model()['tmpls'][0]['qfmt']:
|
||||||
for t in self.note.model().templates:
|
showInfo(_("Please select the cloze deletion note type first."),
|
||||||
if "cloze" in t['qfmt'] or "cloze" in t['afmt']:
|
|
||||||
ok = True
|
|
||||||
break
|
|
||||||
if not ok:
|
|
||||||
showInfo(_("Please use a cloze deletion model."),
|
|
||||||
help="ClozeDeletion")
|
help="ClozeDeletion")
|
||||||
return
|
return
|
||||||
f = self.note.fields[self.currentField]
|
f = self.note.fields[self.currentField]
|
||||||
|
|
|
@ -74,7 +74,7 @@ class ModelChooser(QHBoxLayout):
|
||||||
|
|
||||||
def onModelChange(self, idx):
|
def onModelChange(self, idx):
|
||||||
model = self._models[idx]
|
model = self._models[idx]
|
||||||
self.deck.conf['curModel'] = model.id
|
self.deck.conf['curModel'] = model['id']
|
||||||
self._ignoreReset = True
|
self._ignoreReset = True
|
||||||
runHook("currentModelChanged")
|
runHook("currentModelChanged")
|
||||||
self._ignoreReset = False
|
self._ignoreReset = False
|
||||||
|
|
|
@ -93,7 +93,6 @@ class Models(QDialog):
|
||||||
d = QDialog(self)
|
d = QDialog(self)
|
||||||
frm = aqt.forms.modelopts.Ui_Dialog()
|
frm = aqt.forms.modelopts.Ui_Dialog()
|
||||||
frm.setupUi(d)
|
frm.setupUi(d)
|
||||||
frm.clozeCtx.setChecked(self.model['clozectx'])
|
|
||||||
frm.latexHeader.setText(self.model['latexPre'])
|
frm.latexHeader.setText(self.model['latexPre'])
|
||||||
frm.latexFooter.setText(self.model['latexPost'])
|
frm.latexFooter.setText(self.model['latexPost'])
|
||||||
d.setWindowTitle(_("Options for %s") % self.model['name'])
|
d.setWindowTitle(_("Options for %s") % self.model['name'])
|
||||||
|
@ -101,7 +100,6 @@ class Models(QDialog):
|
||||||
frm.buttonBox, SIGNAL("helpRequested()"),
|
frm.buttonBox, SIGNAL("helpRequested()"),
|
||||||
lambda: openHelp("NoteOptions"))
|
lambda: openHelp("NoteOptions"))
|
||||||
d.exec_()
|
d.exec_()
|
||||||
self.model['clozectx'] = frm.clozeCtx.isChecked()
|
|
||||||
self.model['latexPre'] = unicode(frm.latexHeader.toPlainText())
|
self.model['latexPre'] = unicode(frm.latexHeader.toPlainText())
|
||||||
self.model['latexPost'] = unicode(frm.latexFooter.toPlainText())
|
self.model['latexPost'] = unicode(frm.latexFooter.toPlainText())
|
||||||
|
|
||||||
|
|
|
@ -1,171 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>Dialog</class>
|
|
||||||
<widget class="QDialog" name="Dialog">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>1311</width>
|
|
||||||
<height>658</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>20</x>
|
|
||||||
<y>120</y>
|
|
||||||
<width>360</width>
|
|
||||||
<height>366</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="templateLayout">
|
|
||||||
<property name="verticalSpacing">
|
|
||||||
<number>6</number>
|
|
||||||
</property>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QTextEdit" name="cardQuestion">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
|
||||||
<horstretch>2</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>50</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="horizontalScrollBarPolicy">
|
|
||||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
|
||||||
</property>
|
|
||||||
<property name="tabChangesFocus">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="QTextEdit" name="cardAnswer">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>50</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="horizontalScrollBarPolicy">
|
|
||||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
|
||||||
</property>
|
|
||||||
<property name="tabChangesFocus">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="acceptRichText">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0" rowspan="2">
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_14">
|
|
||||||
<property name="text">
|
|
||||||
<string>Question</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
<property name="openExternalLinks">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_15">
|
|
||||||
<property name="text">
|
|
||||||
<string>Answer</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
<property name="openExternalLinks">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<widget class="QComboBox" name="typeAnswer">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>20</x>
|
|
||||||
<y>500</y>
|
|
||||||
<width>366</width>
|
|
||||||
<height>26</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QCheckBox" name="clozectx">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>20</x>
|
|
||||||
<y>540</y>
|
|
||||||
<width>371</width>
|
|
||||||
<height>20</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Include context in cloze answers</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QWebView" name="preview">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>450</x>
|
|
||||||
<y>90</y>
|
|
||||||
<width>308</width>
|
|
||||||
<height>499</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
|
||||||
<horstretch>1</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="focusPolicy">
|
|
||||||
<enum>Qt::NoFocus</enum>
|
|
||||||
</property>
|
|
||||||
<property name="url">
|
|
||||||
<url>
|
|
||||||
<string>about:blank</string>
|
|
||||||
</url>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
<customwidgets>
|
|
||||||
<customwidget>
|
|
||||||
<class>QWebView</class>
|
|
||||||
<extends>QWidget</extends>
|
|
||||||
<header>QtWebKit/QWebView</header>
|
|
||||||
</customwidget>
|
|
||||||
</customwidgets>
|
|
||||||
<tabstops>
|
|
||||||
<tabstop>cardQuestion</tabstop>
|
|
||||||
<tabstop>cardAnswer</tabstop>
|
|
||||||
</tabstops>
|
|
||||||
<resources>
|
|
||||||
<include location="icons.qrc"/>
|
|
||||||
</resources>
|
|
||||||
<connections/>
|
|
||||||
</ui>
|
|
|
@ -22,33 +22,6 @@
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="tab_2">
|
|
||||||
<attribute name="title">
|
|
||||||
<string>Basic</string>
|
|
||||||
</attribute>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="clozeCtx">
|
|
||||||
<property name="text">
|
|
||||||
<string>Show context in cloze answers</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="verticalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>184</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<widget class="QWidget" name="tab">
|
<widget class="QWidget" name="tab">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
<string>LaTeX</string>
|
<string>LaTeX</string>
|
||||||
|
|
Loading…
Reference in a new issue