mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
add new tag hook
This commit is contained in:
parent
fe029250d9
commit
d401f92016
1 changed files with 5 additions and 0 deletions
|
@ -4,6 +4,7 @@
|
|||
|
||||
import simplejson
|
||||
from anki.utils import intTime, ids2str
|
||||
from anki.hooks import runHook
|
||||
|
||||
"""
|
||||
Anki maintains a cache of used tags so it can quickly present a list of tags
|
||||
|
@ -38,10 +39,14 @@ class TagManager(object):
|
|||
"Given a list of tags, add any missing ones to tag registry."
|
||||
# case is stored as received, so user can create different case
|
||||
# versions of the same tag if they ignore the qt autocomplete.
|
||||
found = False
|
||||
for t in tags:
|
||||
if t not in self.tags:
|
||||
found = True
|
||||
self.tags[t] = self.col.usn() if usn is None else usn
|
||||
self.changed = True
|
||||
if found:
|
||||
runHook("newTag")
|
||||
|
||||
def all(self):
|
||||
return self.tags.keys()
|
||||
|
|
Loading…
Reference in a new issue