diff --git a/ankiqt/ui/cardlist.py b/ankiqt/ui/cardlist.py index 60610da8e..ffc057a14 100644 --- a/ankiqt/ui/cardlist.py +++ b/ankiqt/ui/cardlist.py @@ -596,22 +596,22 @@ where id in (%s)""" % ",".join([ self.deck.setModified() def addFactTags(self): - tags = ui.utils.getText(_("Enter tag(s) to add to each fact:"), self) + tags = ui.utils.getOnlyText(_("Enter tag(s) to add to each fact:"), self) if tags: self.deck.addFactTags(self.selectedFacts(), tags) self.updateAfterCardChange() def addCardTags(self): - tags = ui.utils.getText(_("Enter tag(s) to add to each card:"), self) + tags = ui.utils.getOnlyText(_("Enter tag(s) to add to each card:"), self) if tags: self.deck.addCardTags(self.selectedCards(), tags) self.updateAfterCardChange() def deleteFactTags(self): - tags = ui.utils.getText(_("Enter tag(s) to delete from each fact:"), self) + tags = ui.utils.getOnlyText(_("Enter tag(s) to delete from each fact:"), self) if tags: self.deck.deleteFactTags(self.selectedFacts(), tags) self.updateAfterCardChange() def deleteCardTags(self): - tags = ui.utils.getText(_("Enter tag(s) to delete from each card:"), self) + tags = ui.utils.getOnlyText(_("Enter tag(s) to delete from each card:"), self) if tags: self.deck.deleteCardTags(self.selectedCards(), tags) self.updateAfterCardChange() diff --git a/ankiqt/ui/utils.py b/ankiqt/ui/utils.py index da04e68be..ca1b0ec32 100644 --- a/ankiqt/ui/utils.py +++ b/ankiqt/ui/utils.py @@ -85,6 +85,13 @@ def getText(prompt, parent=None, help=None): ret = d.exec_() return (unicode(d.l.text()), ret) +def getOnlyText(*args, **kwargs): + (s, r) = getText(*args, **kwargs) + if r: + return s + else: + return u"" + def getFile(parent, title, dir, key): "Ask the user for a file. Use DIR as config variable." dirkey = dir+"Directory"