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
|
"sel": ngettext("%d selected", "%d selected", selected) % selected
|
||||||
})
|
})
|
||||||
|
|
||||||
def onEvent(self):
|
def onEvent(self, type='field'):
|
||||||
if self.deck.undoAvailable():
|
if self.deck.undoAvailable():
|
||||||
self.dialog.actionUndo.setText(_("Undo %s") %
|
self.dialog.actionUndo.setText(_("Undo %s") %
|
||||||
self.deck.undoName())
|
self.deck.undoName())
|
||||||
|
@ -529,6 +529,8 @@ class EditDeck(QMainWindow):
|
||||||
# update list
|
# update list
|
||||||
if self.currentRow and self.model.cards:
|
if self.currentRow and self.model.cards:
|
||||||
self.model.updateCard(self.currentRow)
|
self.model.updateCard(self.currentRow)
|
||||||
|
if type == "tag":
|
||||||
|
self.drawTags()
|
||||||
|
|
||||||
def filterTextChanged(self):
|
def filterTextChanged(self):
|
||||||
interval = 300
|
interval = 300
|
||||||
|
@ -730,6 +732,7 @@ where id in (%s)""" % ",".join([
|
||||||
self.rowChanged(self.currentRow, None)
|
self.rowChanged(self.currentRow, None)
|
||||||
if reset:
|
if reset:
|
||||||
self.updateSearch()
|
self.updateSearch()
|
||||||
|
self.drawTags()
|
||||||
self.parent.moveToState("auto")
|
self.parent.moveToState("auto")
|
||||||
|
|
||||||
# Menu options
|
# Menu options
|
||||||
|
|
|
@ -512,7 +512,7 @@ class FactEditor(object):
|
||||||
self.saveFields()
|
self.saveFields()
|
||||||
self.checkValid()
|
self.checkValid()
|
||||||
if self.onChange:
|
if self.onChange:
|
||||||
self.onChange()
|
self.onChange('field')
|
||||||
self.changeTimer = None
|
self.changeTimer = None
|
||||||
|
|
||||||
def saveFieldsNow(self):
|
def saveFieldsNow(self):
|
||||||
|
@ -524,7 +524,7 @@ class FactEditor(object):
|
||||||
self.changeTimer.stop()
|
self.changeTimer.stop()
|
||||||
self.changeTimer = None
|
self.changeTimer = None
|
||||||
if self.onChange:
|
if self.onChange:
|
||||||
self.onChange()
|
self.onChange('field')
|
||||||
# save fields and run features
|
# save fields and run features
|
||||||
w = self.focusedEdit()
|
w = self.focusedEdit()
|
||||||
if w:
|
if w:
|
||||||
|
@ -566,14 +566,14 @@ class FactEditor(object):
|
||||||
return
|
return
|
||||||
old = self.fact.tags
|
old = self.fact.tags
|
||||||
self.fact.tags = canonifyTags(unicode(self.tags.text()))
|
self.fact.tags = canonifyTags(unicode(self.tags.text()))
|
||||||
if self.onChange:
|
|
||||||
self.onChange()
|
|
||||||
if old != self.fact.tags:
|
if old != self.fact.tags:
|
||||||
self.deck.s.flush()
|
self.deck.s.flush()
|
||||||
self.deck.updateFactTags([self.fact.id])
|
self.deck.updateFactTags([self.fact.id])
|
||||||
self.deck.updatePriorities([c.id for c in self.fact.cards])
|
self.deck.updatePriorities([c.id for c in self.fact.cards])
|
||||||
self.fact.setModified(textChanged=True)
|
self.fact.setModified(textChanged=True)
|
||||||
self.deck.flushMod()
|
self.deck.flushMod()
|
||||||
|
if self.onChange:
|
||||||
|
self.onChange('tag')
|
||||||
|
|
||||||
def focusField(self, fieldName):
|
def focusField(self, fieldName):
|
||||||
self.fields[fieldName][1].setFocus()
|
self.fields[fieldName][1].setFocus()
|
||||||
|
|
Loading…
Reference in a new issue