Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/tutorius/addon.py
diff options
context:
space:
mode:
authorSimon Poirier <simpoir@gmail.com>2009-10-24 21:18:52 (GMT)
committer Simon Poirier <simpoir@gmail.com>2009-10-24 21:18:52 (GMT)
commita6e312c9f0e1bd690963191bb5331eaabb06b431 (patch)
treea9f8589299de7bf09291e94e533005dc0cee7f10 /tutorius/addon.py
parent704e35494433a11ecdcf675fff7cfccaa8bbd2ec (diff)
creator with viewer and non-linear editing.
Conflicts: tutorius/creator.py
Diffstat (limited to 'tutorius/addon.py')
-rw-r--r--tutorius/addon.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tutorius/addon.py b/tutorius/addon.py
index 15612c8..7ac68f7 100644
--- a/tutorius/addon.py
+++ b/tutorius/addon.py
@@ -38,6 +38,9 @@ import logging
PREFIX = __name__+"s"
PATH = re.sub("addon\\.py[c]$", "", __file__)+"addons"
+TYPE_ACTION = 'action'
+TYPE_EVENT = 'event'
+
_cache = None
def _reload_addons():
@@ -47,9 +50,11 @@ def _reload_addons():
mod = __import__(PREFIX+'.'+re.sub("\\.py$", "", addon), {}, {}, [""])
if hasattr(mod, "__action__"):
_cache[mod.__action__['name']] = mod.__action__
+ mod.__action__['type'] = TYPE_ACTION
continue
if hasattr(mod, "__event__"):
_cache[mod.__event__['name']] = mod.__event__
+ mod.__event__['type'] = TYPE_EVENT
def create(name, *args, **kwargs):
global _cache
@@ -78,4 +83,13 @@ def get_addon_meta(name):
_reload_addons()
return _cache[name]
+def get_name_from_type(typ):
+ global _cache
+ if not _cache:
+ _reload_addons()
+ for addon in _cache.keys():
+ if typ == _cache[addon]['class']:
+ return addon
+ return None
+
# vim:set ts=4 sts=4 sw=4 et: