add a method to gather the plugins resources for when they need to be loaded after the ui

This commit is contained in:
Damien Churchill 2009-09-14 16:31:59 +00:00
parent 6fc1e23fce
commit 137be4c8f1
2 changed files with 18 additions and 0 deletions

View File

@ -785,6 +785,10 @@ class WebApi(JSONComponent):
def get_plugin_info(self, name):
return component.get("Web.PluginManager").get_plugin_info(name)
@export
def get_plugin_resources(self, name):
return component.get("Web.PluginManager").get_plugin_resources(name)
@export
def register_event_listener(self, event):
"""

View File

@ -135,3 +135,17 @@ class PluginManager(PluginManagerBase, component.Component):
def update(self):
pass
def get_plugin_resources(self, name):
# Get the plugin instance
try:
plugin = component.get("WebPlugin." + name)
except KeyError:
log.info("Plugin has no web ui")
return
info = gather_info(plugin)
info["name"] = name
info["scripts"] = ["/js/%s/%s" % (name.lower(), os.path.basename(s)) for s in info["scripts"]]
info["debug_scripts"] = ["/js/%s/%s" % (name.lower(), os.path.basename(s)) for s in info["debug_scripts"]]
del info["script_directories"]
return info