mirror of
https://github.com/codex-storage/deluge.git
synced 2025-02-17 05:47:50 +00:00
add a method to gather the plugins resources for when they need to be loaded after the ui
This commit is contained in:
parent
6fc1e23fce
commit
137be4c8f1
@ -785,6 +785,10 @@ class WebApi(JSONComponent):
|
|||||||
def get_plugin_info(self, name):
|
def get_plugin_info(self, name):
|
||||||
return component.get("Web.PluginManager").get_plugin_info(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
|
@export
|
||||||
def register_event_listener(self, event):
|
def register_event_listener(self, event):
|
||||||
"""
|
"""
|
||||||
|
@ -135,3 +135,17 @@ class PluginManager(PluginManagerBase, component.Component):
|
|||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
pass
|
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
|
Loading…
x
Reference in New Issue
Block a user