tidy up the code attaching the script

This commit is contained in:
Damien Churchill 2009-04-30 07:12:35 +00:00
parent 6669dbb4a0
commit d09cd4908e
1 changed files with 8 additions and 10 deletions

View File

@ -32,17 +32,15 @@ from deluge.plugins.pluginbase import WebPluginBase
class WebUI(WebPluginBase): class WebUI(WebPluginBase):
def enable(self): def enable(self):
log.debug("Execute Web plugin enabled!") log.debug("Execute Web plugin enabled!")
deluge_web = component.get("DelugeWeb") deluge_web = component.get("DelugeWeb").top_level
deluge_web.top_level.scripts.append("/js/deluge-execute.js") deluge_web.scripts.append("/js/deluge-execute.js")
deluge_web.top_level.debug_scripts.append("/js/deluge-execute.js") deluge_web.debug_scripts.append("/js/deluge-execute.js")
javascript = component.get("Javascript") javascript = component.get("Javascript").directories
js_path = pkg_resources.resource_filename("execute", "data") javascript.append(pkg_resources.resource_filename("execute", "data"))
print js_path
javascript.directories.append(js_path)
def disable(self): def disable(self):
log.debug("Execute Web plugin disabled!") log.debug("Execute Web plugin disabled!")
deluge_web = component.get("DelugeWeb") deluge_web = component.get("DelugeWeb").top_level
deluge_web.top_level.scripts.remove("/js/deluge-execute.js") deluge_web.scripts.remove("/js/deluge-execute.js")
deluge_web.top_level.debug_scripts.remove("/js/deluge-execute.js") deluge_web.debug_scripts.remove("/js/deluge-execute.js")