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