From 225196f7d1d2c08ceb222d6068a6413542fb2e69 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Thu, 24 May 2012 18:20:16 +0900 Subject: [PATCH] run hook on deck/model creation --- anki/decks.py | 2 ++ anki/models.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/anki/decks.py b/anki/decks.py index f4f50b702..986b69804 100644 --- a/anki/decks.py +++ b/anki/decks.py @@ -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): diff --git a/anki/models.py b/anki/models.py index b32792c82..a7e04d1af 100644 --- a/anki/models.py +++ b/anki/models.py @@ -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."