fix issue #1567, js from plugins not working with different base setting
This commit is contained in:
parent
922e64a07e
commit
5ad21303c6
|
@ -1,6 +1,6 @@
|
|||
/*!
|
||||
* Deluge.UI.js
|
||||
*
|
||||
*
|
||||
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
@ -75,7 +75,7 @@ deluge.ui = {
|
|||
layout: 'fit',
|
||||
items: [this.MainPanel]
|
||||
});
|
||||
|
||||
|
||||
deluge.events.on("connect", this.onConnect, this);
|
||||
deluge.events.on("disconnect", this.onDisconnect, this);
|
||||
deluge.events.on('PluginDisabledEvent', this.onPluginDisabled, this);
|
||||
|
@ -83,7 +83,7 @@ deluge.ui = {
|
|||
deluge.client = new Ext.ux.util.RpcClient({
|
||||
url: deluge.config.base + 'json'
|
||||
});
|
||||
|
||||
|
||||
// enable all the already active plugins
|
||||
for (var plugin in Deluge.pluginStore) {
|
||||
plugin = Deluge.createPlugin(plugin);
|
||||
|
@ -93,11 +93,11 @@ deluge.ui = {
|
|||
|
||||
// Initialize quicktips so all the tooltip configs start working.
|
||||
Ext.QuickTips.init();
|
||||
|
||||
|
||||
deluge.client.on('connected', function(e) {
|
||||
deluge.login.show();
|
||||
}, this, {single: true});
|
||||
|
||||
|
||||
this.update = this.update.createDelegate(this);
|
||||
this.checkConnection = this.checkConnection.createDelegate(this);
|
||||
|
||||
|
@ -126,7 +126,7 @@ deluge.ui = {
|
|||
},
|
||||
|
||||
onConnectionError: function(error) {
|
||||
|
||||
|
||||
},
|
||||
|
||||
onConnectionSuccess: function(result) {
|
||||
|
@ -169,8 +169,8 @@ deluge.ui = {
|
|||
}
|
||||
|
||||
if (deluge.config.show_session_speed) {
|
||||
document.title = this.originalTitle +
|
||||
' (Down: ' + fspeed(data['stats'].download_rate, true) +
|
||||
document.title = this.originalTitle +
|
||||
' (Down: ' + fspeed(data['stats'].download_rate, true) +
|
||||
' Up: ' + fspeed(data['stats'].upload_rate, true) + ')';
|
||||
}
|
||||
if (Ext.areObjectsEqual(this.filters, this.oldFilters)) {
|
||||
|
@ -232,7 +232,7 @@ deluge.ui = {
|
|||
var scripts = (Deluge.debug) ? resources.debug_scripts : resources.scripts;
|
||||
Ext.each(scripts, function(script) {
|
||||
Ext.ux.JSLoader({
|
||||
url: script,
|
||||
url: deluge.config.base + script,
|
||||
onLoad: this.onPluginLoaded,
|
||||
pluginName: resources.name
|
||||
});
|
||||
|
|
|
@ -58,20 +58,20 @@ def gather_info(plugin):
|
|||
"debug_scripts": debug_scripts,
|
||||
"script_directories": directories
|
||||
}
|
||||
|
||||
|
||||
class PluginManager(PluginManagerBase, component.Component):
|
||||
def __init__(self):
|
||||
component.Component.__init__(self, "Web.PluginManager")
|
||||
self.config = ConfigManager("web.conf")
|
||||
PluginManagerBase.__init__(self, "web.conf", "deluge.plugin.web")
|
||||
|
||||
|
||||
client.register_event_handler("PluginEnabledEvent", self._on_plugin_enabled_event)
|
||||
client.register_event_handler("PluginDisabledEvent", self._on_plugin_disabled_event)
|
||||
|
||||
|
||||
def _on_get_enabled_plugins(self, plugins):
|
||||
for plugin in plugins:
|
||||
self.enable_plugin(plugin)
|
||||
|
||||
|
||||
def _on_plugin_enabled_event(self, name):
|
||||
self.enable_plugin(name)
|
||||
|
||||
|
@ -85,31 +85,31 @@ class PluginManager(PluginManagerBase, component.Component):
|
|||
except KeyError:
|
||||
log.info("Plugin has no web ui")
|
||||
return
|
||||
|
||||
|
||||
info = gather_info(plugin)
|
||||
|
||||
scripts = component.get("Scripts")
|
||||
for script in info["scripts"]:
|
||||
scripts.remove_script("%s/%s" % (name.lower(), os.path.basename(script).lower()))
|
||||
|
||||
|
||||
for script in info["debug_scripts"]:
|
||||
scripts.remove_script("%s/%s" % (name.lower(), os.path.basename(script).lower()), "debug")
|
||||
scripts.remove_script("%s/%s" % (name.lower(), os.path.basename(script).lower()), "dev")
|
||||
|
||||
|
||||
super(PluginManager, self).disable_plugin(name)
|
||||
|
||||
|
||||
def enable_plugin(self, name):
|
||||
super(PluginManager, self).enable_plugin(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)
|
||||
|
||||
|
||||
scripts = component.get("Scripts")
|
||||
for script in info["scripts"]:
|
||||
log.debug("adding script %s for %s", name, os.path.basename(script))
|
||||
|
@ -127,16 +127,16 @@ class PluginManager(PluginManagerBase, component.Component):
|
|||
# Update the enabled plugins from the core
|
||||
d = client.core.get_enabled_plugins()
|
||||
d.addCallback(self._on_get_enabled_plugins)
|
||||
|
||||
|
||||
def stop(self):
|
||||
"""
|
||||
Stop the plugin manager
|
||||
"""
|
||||
self.disable_plugins()
|
||||
|
||||
|
||||
def update(self):
|
||||
pass
|
||||
|
||||
|
||||
def get_plugin_resources(self, name):
|
||||
# Get the plugin instance
|
||||
try:
|
||||
|
@ -146,7 +146,7 @@ class PluginManager(PluginManagerBase, component.Component):
|
|||
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"]]
|
||||
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…
Reference in New Issue