From 9be54918fb56df8d324ab9232266d89c82b67ea2 Mon Sep 17 00:00:00 2001 From: Damien Churchill Date: Thu, 16 Apr 2009 19:59:34 +0000 Subject: [PATCH] generate the - - %if debug: - - %else: - - %endif - - - - - - - - - - - - - - - - - + %for script in scripts: + + %endfor diff --git a/deluge/ui/web/js/deluge-ui.js b/deluge/ui/web/js/deluge-ui.js index 1d704865c..3e0257f0d 100644 --- a/deluge/ui/web/js/deluge-ui.js +++ b/deluge/ui/web/js/deluge-ui.js @@ -25,9 +25,6 @@ Copyright: Deluge.UI = { initialize: function() { this.errorCount = 0; - this.roar = new Roar({ - position: 'lowerRight' - }); Ext.state.Manager.setProvider(new Ext.state.CookieProvider()); this.MainPanel = new Ext.Panel({ id: 'mainPanel', @@ -55,10 +52,6 @@ Deluge.UI = { Deluge.Client = new JSON.RPC('/json'); }, - notify: function(title, message) { - //this.roar.alert(title, message); - }, - update: function() { var filters = Deluge.SideBar.getFilters(); Deluge.Client.web.update_ui(Deluge.Keys.Grid, filters, { diff --git a/deluge/ui/web/server.py b/deluge/ui/web/server.py index 640b46f89..c6173ea1d 100644 --- a/deluge/ui/web/server.py +++ b/deluge/ui/web/server.py @@ -228,6 +228,41 @@ class TopLevel(resource.Resource): self.putChild("render", Render()) self.putChild("themes", static.File(rpath("themes"))) self.putChild("tracker", Tracker()) + + self.__stylesheets = [ + "/css/ext-all.css", + "/css/xtheme-slate.css", + "/css/Spinner.css", + "/css/deluge.css" + ] + self.__scripts = [ + "/js/mootools-1.2.1-core-yc.js", + "/js/ext-mootools-adapter.js", + "/js/ext-all.js", + "/js/Spinner.js", + "/js/SpinnerStrategy.js", + "/js/rpc.js", + "/gettext.js", + "/js/deluge.js", + "/js/deluge-ext.js", + "/js/deluge-login.js", + "/js/deluge-menus.js", + "/js/deluge-bars.js", + "/js/deluge-connections.js", + "/js/deluge-torrents.js", + "/js/deluge-details.js", + "/js/deluge-add.js", + "/js/deluge-preferences.js", + "/js/deluge-ui.js" + ] + + @property + def scripts(self): + return self.__scripts + + @property + def stylesheets(self): + return self.__stylesheets def getChild(self, path, request): if path == "": @@ -236,15 +271,19 @@ class TopLevel(resource.Resource): return resource.Resource.getChild(self, path, request) def render(self, request): - debug = request.args.get('debug', ['false'])[-1] == 'true' + scripts = self.scripts[:] + if request.args.get('debug', ['false'])[-1] == 'true': + i = scripts.index("/js/ext-all.js") + scripts[i] = "/js/ext-all-debug.js" template = Template(filename=rpath("index.html")) request.setHeader("content-type", "text/html; charset=utf-8") - return template.render(debug=debug) + return template.render(scripts=scripts, stylesheets=self.stylesheets) class DelugeWeb(component.Component): def __init__(self): super(DelugeWeb, self).__init__("DelugeWeb") - self.site = server.Site(TopLevel()) + self.top_level = TopLevel() + self.site = server.Site(self.top_level) self.config = ConfigManager("web.conf", CONFIG_DEFAULTS) self.port = self.config["port"] self.web_api = WebApi() @@ -264,7 +303,7 @@ class DelugeWeb(component.Component): self.__shutdown() return 1 SetConsoleCtrlHandler(win_handler) - + def start(self): log.info("%s %s.", _("Starting server in PID"), os.getpid()) reactor.listenTCP(self.port, self.site)