From d401f92016d17f618013805d704322c4d3319751 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Tue, 24 Apr 2012 09:12:07 +0900 Subject: [PATCH] add new tag hook --- anki/tags.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/anki/tags.py b/anki/tags.py index 0c115b545..a9096d9f8 100644 --- a/anki/tags.py +++ b/anki/tags.py @@ -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()