run hook on deck/model creation

This commit is contained in:
Damien Elmes 2012-05-24 18:20:16 +09:00
parent bde4655fa5
commit 225196f7d1
2 changed files with 4 additions and 0 deletions

View file

@ -4,6 +4,7 @@
import copy
from anki.utils import intTime, ids2str, json
from anki.hooks import runHook
from anki.consts import *
from anki.lang import _
from anki.errors import DeckRenameError
@ -127,6 +128,7 @@ class DeckManager(object):
self.decks[str(id)] = g
self.save(g)
self.maybeAddToActive()
runHook("newDeck")
return int(id)
def rem(self, did, cardsToo=False, childrenToo=True):

View file

@ -7,6 +7,7 @@ from anki.utils import intTime, hexifyID, joinFields, splitFields, ids2str, \
timestampID, fieldChecksum, json
from anki.lang import _
from anki.consts import *
from anki.hooks import runHook
# Models
##########################################################################
@ -86,6 +87,7 @@ class ModelManager(object):
if templates:
self._syncTemplates(m)
self.changed = True
runHook("newModel")
def flush(self):
"Flush the registry if any models were changed."