diff --git a/ankiqt/ui/addcards.py b/ankiqt/ui/addcards.py index a7b15d006..f222c4e40 100644 --- a/ankiqt/ui/addcards.py +++ b/ankiqt/ui/addcards.py @@ -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), diff --git a/ankiqt/ui/modelproperties.py b/ankiqt/ui/modelproperties.py index d575675a8..fbb6fb086 100644 --- a/ankiqt/ui/modelproperties.py +++ b/ankiqt/ui/modelproperties.py @@ -291,10 +291,8 @@ class ModelProperties(QDialog): self.dialog.cardName.setText(card.name) self.dialog.cardQuestion.setPlainText(card.qformat.replace("
", "\n")) self.dialog.cardAnswer.setPlainText(card.aformat.replace("
", "\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) diff --git a/designer/main.ui b/designer/main.ui index 7214283fe..52b8a987e 100644 --- a/designer/main.ui +++ b/designer/main.ui @@ -23,6 +23,14 @@ :/icons/anki.png:/icons/anki.png + + + 0 + 69 + 655 + 398 + + 1 @@ -141,8 +149,25 @@ 0 - + + + + 0 + 0 + 370 + 343 + + + + + + 0 + 0 + 100 + 30 + + @@ -157,6 +182,14 @@ + + + 0 + 0 + 100 + 30 + + 0 @@ -177,6 +210,14 @@ 3 + + + 0 + 0 + 100 + 30 + + @@ -201,6 +242,14 @@ + + + 0 + 0 + 100 + 30 + + 0 @@ -331,6 +380,14 @@ + + + 0 + 0 + 100 + 30 + + @@ -357,7 +414,16 @@ - + + + + 0 + 0 + 370 + 49 + + + @@ -552,7 +618,7 @@ 0 0 655 - 25 + 23 @@ -633,7 +699,7 @@ - &Advanced + Ad&vanced @@ -690,11 +756,28 @@ - + + + + 0 + 467 + 655 + 20 + + + true + + + 0 + 23 + 655 + 46 + + Qt::Horizontal diff --git a/designer/modelproperties.ui b/designer/modelproperties.ui index 5b83d8d5e..27e6c4d9b 100644 --- a/designer/modelproperties.ui +++ b/designer/modelproperties.ui @@ -9,7 +9,7 @@ 0 0 376 - 528 + 518 @@ -27,7 +27,7 @@ 0 0 360 - 462 + 452 @@ -121,7 +121,7 @@ - + Qt::Horizontal @@ -215,15 +215,12 @@ - - - 6 - - - 9 - + + false + + - + 0 @@ -233,7 +230,7 @@ - <b>Unique? + <b>Options</b> @@ -253,14 +250,7 @@ <b>Name</b> - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - - - <b>Required?</b> + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter @@ -271,13 +261,6 @@ - - - - <b>Numeric?</b> - - - @@ -297,8 +280,8 @@ 0 0 - 370 - 462 + 360 + 452 @@ -385,24 +368,12 @@ - - - 0 - 3 - - - - - 6 - - - 9 - + - + 0 @@ -412,7 +383,7 @@ - <b>Question hiding</b> + <b>Options</b> @@ -451,10 +422,10 @@ - <b>Answer format</b> + <b>Answer</b> - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter true @@ -486,13 +457,20 @@ + + + + Allow the answer to be blank + + + - <b>Name/tag</b> + <b>Name</b> - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter true @@ -502,10 +480,10 @@ - <b>Question format</b> + <b>Question</b> - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter true @@ -532,9 +510,15 @@ + buttonBox + tabWidget tabWidget + name + tags + initialSpacing + spacing fieldList fieldAdd fieldUp @@ -554,6 +538,7 @@ cardQuestion cardAnswer questionInAnswer + allowEmptyAnswer buttonBox