From e1d8c31a1e8594d59050f32db365c955fa0b0a08 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sat, 9 May 2009 03:28:47 +0900 Subject: [PATCH] update tags list when tags are changed --- ankiqt/ui/cardlist.py | 5 ++++- ankiqt/ui/facteditor.py | 8 ++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ankiqt/ui/cardlist.py b/ankiqt/ui/cardlist.py index dc43ddb65..4cf3b2a99 100644 --- a/ankiqt/ui/cardlist.py +++ b/ankiqt/ui/cardlist.py @@ -513,7 +513,7 @@ class EditDeck(QMainWindow): "sel": ngettext("%d selected", "%d selected", selected) % selected }) - def onEvent(self): + def onEvent(self, type='field'): if self.deck.undoAvailable(): self.dialog.actionUndo.setText(_("Undo %s") % self.deck.undoName()) @@ -529,6 +529,8 @@ class EditDeck(QMainWindow): # update list if self.currentRow and self.model.cards: self.model.updateCard(self.currentRow) + if type == "tag": + self.drawTags() def filterTextChanged(self): interval = 300 @@ -730,6 +732,7 @@ where id in (%s)""" % ",".join([ self.rowChanged(self.currentRow, None) if reset: self.updateSearch() + self.drawTags() self.parent.moveToState("auto") # Menu options diff --git a/ankiqt/ui/facteditor.py b/ankiqt/ui/facteditor.py index 9ee6d967a..6a90c8bab 100644 --- a/ankiqt/ui/facteditor.py +++ b/ankiqt/ui/facteditor.py @@ -512,7 +512,7 @@ class FactEditor(object): self.saveFields() self.checkValid() if self.onChange: - self.onChange() + self.onChange('field') self.changeTimer = None def saveFieldsNow(self): @@ -524,7 +524,7 @@ class FactEditor(object): self.changeTimer.stop() self.changeTimer = None if self.onChange: - self.onChange() + self.onChange('field') # save fields and run features w = self.focusedEdit() if w: @@ -566,14 +566,14 @@ class FactEditor(object): return old = self.fact.tags self.fact.tags = canonifyTags(unicode(self.tags.text())) - if self.onChange: - self.onChange() if old != self.fact.tags: self.deck.s.flush() self.deck.updateFactTags([self.fact.id]) self.deck.updatePriorities([c.id for c in self.fact.cards]) self.fact.setModified(textChanged=True) self.deck.flushMod() + if self.onChange: + self.onChange('tag') def focusField(self, fieldName): self.fields[fieldName][1].setFocus()