mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-08 09:28:41 +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
2 changed files with 18 additions and 0 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue