mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
run hook on deck/model creation
This commit is contained in:
parent
bde4655fa5
commit
225196f7d1
2 changed files with 4 additions and 0 deletions
|
@ -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):
|
||||
|
|
|
@ -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."
|
||||
|
|
Loading…
Reference in a new issue