mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 08:46:37 -04:00
default to optional answer, add config option to card model, tweak dialogs
This commit is contained in:
parent
a5c445369d
commit
504749b741
4 changed files with 128 additions and 61 deletions
|
@ -104,10 +104,10 @@ class AddCards(QDialog):
|
|||
"Some fields are missing or not unique."),
|
||||
parent=self, help="AddItems#AddError")
|
||||
return
|
||||
if not fact.cards:
|
||||
if not fact:
|
||||
ui.utils.showWarning(_("""\
|
||||
The input you have provided would make an empty
|
||||
question or answer on all cards. Can't proceed."""), parent=self)
|
||||
question or answer on all cards."""), parent=self)
|
||||
return
|
||||
self.dialog.status.append(_("Added %(num)d card(s) for '%(str)s'.") % {
|
||||
"num": len(fact.cards),
|
||||
|
|
|
@ -291,10 +291,8 @@ class ModelProperties(QDialog):
|
|||
self.dialog.cardName.setText(card.name)
|
||||
self.dialog.cardQuestion.setPlainText(card.qformat.replace("<br>", "\n"))
|
||||
self.dialog.cardAnswer.setPlainText(card.aformat.replace("<br>", "\n"))
|
||||
if card.questionInAnswer:
|
||||
self.dialog.questionInAnswer.setCheckState(Qt.Checked)
|
||||
else:
|
||||
self.dialog.questionInAnswer.setCheckState(Qt.Unchecked)
|
||||
self.dialog.questionInAnswer.setChecked(card.questionInAnswer)
|
||||
self.dialog.allowEmptyAnswer.setChecked(card.allowEmptyAnswer)
|
||||
self.updateToggleButtonText(card)
|
||||
|
||||
def enableCardMoveButtons(self):
|
||||
|
@ -330,6 +328,7 @@ class ModelProperties(QDialog):
|
|||
changed2 = self.updateField(card, 'aformat', s)
|
||||
changed = changed or changed2
|
||||
self.updateField(card, 'questionInAnswer', self.dialog.questionInAnswer.isChecked())
|
||||
self.updateField(card, 'allowEmptyAnswer', self.dialog.allowEmptyAnswer.isChecked())
|
||||
if changed:
|
||||
# need to generate all question/answers for this card
|
||||
self.deck.updateCardsFromModel(self.m)
|
||||
|
|
|
@ -23,6 +23,14 @@
|
|||
<normaloff>:/icons/anki.png</normaloff>:/icons/anki.png</iconset>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>69</y>
|
||||
<width>655</width>
|
||||
<height>398</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
|
||||
<horstretch>1</horstretch>
|
||||
|
@ -141,8 +149,25 @@
|
|||
<property name="currentIndex" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="blankPage" />
|
||||
<widget class="QWidget" name="blankPage" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>370</width>
|
||||
<height>343</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QWidget" name="welcomePage" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>100</width>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5" >
|
||||
<item>
|
||||
<widget class="QTextBrowser" name="welcomeText" >
|
||||
|
@ -157,6 +182,14 @@
|
|||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="editPage" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>100</width>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2" >
|
||||
<property name="spacing" >
|
||||
<number>0</number>
|
||||
|
@ -177,6 +210,14 @@
|
|||
<number>3</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page1" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>100</width>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout" >
|
||||
<item>
|
||||
<spacer name="verticalSpacer" >
|
||||
|
@ -201,6 +242,14 @@
|
|||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page2" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>100</width>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3" >
|
||||
<property name="spacing" >
|
||||
<number>0</number>
|
||||
|
@ -331,6 +380,14 @@
|
|||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page3" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>100</width>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4" >
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2" >
|
||||
|
@ -357,7 +414,16 @@
|
|||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page4" />
|
||||
<widget class="QWidget" name="page4" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>370</width>
|
||||
<height>49</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -552,7 +618,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>655</width>
|
||||
<height>25</height>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuHelp" >
|
||||
|
@ -633,7 +699,7 @@
|
|||
</widget>
|
||||
<widget class="QMenu" name="menuAdvanced" >
|
||||
<property name="title" >
|
||||
<string>&Advanced</string>
|
||||
<string>Ad&vanced</string>
|
||||
</property>
|
||||
<addaction name="actionCheckDatabaseIntegrity" />
|
||||
<addaction name="actionCheckMediaDatabase" />
|
||||
|
@ -690,11 +756,28 @@
|
|||
<addaction name="menu_Settings" />
|
||||
<addaction name="menuHelp" />
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusbar" />
|
||||
<widget class="QStatusBar" name="statusbar" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>467</y>
|
||||
<width>655</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QToolBar" name="toolBar" >
|
||||
<property name="enabled" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>23</y>
|
||||
<width>655</width>
|
||||
<height>46</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>376</width>
|
||||
<height>528</height>
|
||||
<height>518</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
|
@ -27,7 +27,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>360</width>
|
||||
<height>462</height>
|
||||
<height>452</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="title" >
|
||||
|
@ -121,7 +121,7 @@
|
|||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line" >
|
||||
<widget class="Line" name="line_3" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
|
@ -215,15 +215,12 @@
|
|||
<property name="title" >
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="flat" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2" >
|
||||
<item>
|
||||
<layout class="QGridLayout" >
|
||||
<layout class="QGridLayout" name="_2" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
|
@ -233,7 +230,7 @@
|
|||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="label_18" >
|
||||
<property name="text" >
|
||||
<string><b>Unique?</string>
|
||||
<string><b>Options</b></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -253,14 +250,7 @@
|
|||
<string><b>Name</b></string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" >
|
||||
<widget class="QLabel" name="label_17" >
|
||||
<property name="text" >
|
||||
<string><b>Required?</b></string>
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -271,13 +261,6 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" >
|
||||
<widget class="QLabel" name="label_21" >
|
||||
<property name="text" >
|
||||
<string><b>Numeric?</b></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" >
|
||||
<widget class="QCheckBox" name="numeric" >
|
||||
<property name="text" >
|
||||
|
@ -297,8 +280,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>370</width>
|
||||
<height>462</height>
|
||||
<width>360</width>
|
||||
<height>452</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="title" >
|
||||
|
@ -385,24 +368,12 @@
|
|||
</item>
|
||||
<item row="3" column="0" >
|
||||
<widget class="QGroupBox" name="cardEditBox" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="MinimumExpanding" hsizetype="Preferred" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>3</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title" >
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3" >
|
||||
<item>
|
||||
<layout class="QGridLayout" >
|
||||
<layout class="QGridLayout" name="_3" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
|
@ -412,7 +383,7 @@
|
|||
<item row="3" column="0" >
|
||||
<widget class="QLabel" name="label_23" >
|
||||
<property name="text" >
|
||||
<string><b>Question hiding</b></string>
|
||||
<string><b>Options</b></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -451,10 +422,10 @@
|
|||
<item row="2" column="0" >
|
||||
<widget class="QLabel" name="label_15" >
|
||||
<property name="text" >
|
||||
<string><b>Answer format</b></string>
|
||||
<string><b>Answer</b></string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="openExternalLinks" >
|
||||
<bool>true</bool>
|
||||
|
@ -486,13 +457,20 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1" >
|
||||
<widget class="QCheckBox" name="allowEmptyAnswer" >
|
||||
<property name="text" >
|
||||
<string>Allow the answer to be blank</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="label_12" >
|
||||
<property name="text" >
|
||||
<string><b>Name/tag</b></string>
|
||||
<string><b>Name</b></string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="openExternalLinks" >
|
||||
<bool>true</bool>
|
||||
|
@ -502,10 +480,10 @@
|
|||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="label_14" >
|
||||
<property name="text" >
|
||||
<string><b>Question format</b></string>
|
||||
<string><b>Question</b></string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="openExternalLinks" >
|
||||
<bool>true</bool>
|
||||
|
@ -532,9 +510,15 @@
|
|||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<zorder>buttonBox</zorder>
|
||||
<zorder>tabWidget</zorder>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>tabWidget</tabstop>
|
||||
<tabstop>name</tabstop>
|
||||
<tabstop>tags</tabstop>
|
||||
<tabstop>initialSpacing</tabstop>
|
||||
<tabstop>spacing</tabstop>
|
||||
<tabstop>fieldList</tabstop>
|
||||
<tabstop>fieldAdd</tabstop>
|
||||
<tabstop>fieldUp</tabstop>
|
||||
|
@ -554,6 +538,7 @@
|
|||
<tabstop>cardQuestion</tabstop>
|
||||
<tabstop>cardAnswer</tabstop>
|
||||
<tabstop>questionInAnswer</tabstop>
|
||||
<tabstop>allowEmptyAnswer</tabstop>
|
||||
<tabstop>buttonBox</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
|
|
Loading…
Reference in a new issue