From 7d74be890be3e40d454716503e366874cf04f3a3 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sat, 6 Feb 2010 02:01:26 +0900 Subject: [PATCH] better warning about setting templates to nothing --- ankiqt/ui/cardlist.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/ankiqt/ui/cardlist.py b/ankiqt/ui/cardlist.py index f1fe22f17..81869574f 100644 --- a/ankiqt/ui/cardlist.py +++ b/ankiqt/ui/cardlist.py @@ -1383,18 +1383,16 @@ class ChangeModelDialog(QDialog): # check maps fmap = self.getFieldMap() cmap = self.getTemplateMap() - def any(l): - for x in l: - if x: - return True - return False if not cmap or (self.targetModel != self.oldModel and not fmap): return ui.utils.showInfo( _("Targets must be unique."), parent=self) - if not any(cmap.values()): - return ui.utils.showInfo( - _("Must map at least one template."), parent=self) + if [c for c in cmap.values() if not c]: + if not ui.utils.askUser(_("""\ +Any cards with templates mapped to nothing will be deleted. +If a fact has no remaining cards, it will be lost. +Are you sure you want to continue?"""), parent=self): + return if self.targetModel == self.oldModel: self.ret = (self.targetModel, None, cmap) return QDialog.accept(self)