mirror of
https://github.com/ankitects/anki.git
synced 2025-09-22 16:02:23 -04:00
update tags list when tags are changed
This commit is contained in:
parent
02930e5713
commit
e1d8c31a1e
2 changed files with 8 additions and 5 deletions
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue