fix starting the web via deluge -u web
allow the theme to be specified in the config file
This commit is contained in:
parent
b43e0f6eaa
commit
c73966bdd1
|
@ -68,7 +68,7 @@ current_dir = os.path.dirname(__file__)
|
||||||
|
|
||||||
CONFIG_DEFAULTS = {
|
CONFIG_DEFAULTS = {
|
||||||
"port": 8112,
|
"port": 8112,
|
||||||
"template": "slate",
|
"theme": "slate",
|
||||||
"pwd_salt": "16f65d5c79b7e93278a28b60fed2431e",
|
"pwd_salt": "16f65d5c79b7e93278a28b60fed2431e",
|
||||||
"pwd_md5": "2c9baa929ca38fb5c9eb5b054474d1ce",
|
"pwd_md5": "2c9baa929ca38fb5c9eb5b054474d1ce",
|
||||||
"base": "",
|
"base": "",
|
||||||
|
@ -220,7 +220,6 @@ class TopLevel(resource.Resource):
|
||||||
|
|
||||||
__stylesheets = [
|
__stylesheets = [
|
||||||
"/css/ext-all.css",
|
"/css/ext-all.css",
|
||||||
"/css/xtheme-slate.css",
|
|
||||||
"/css/Spinner.css",
|
"/css/Spinner.css",
|
||||||
"/css/deluge.css"
|
"/css/deluge.css"
|
||||||
]
|
]
|
||||||
|
@ -284,6 +283,9 @@ class TopLevel(resource.Resource):
|
||||||
self.putChild("themes", static.File(rpath("themes")))
|
self.putChild("themes", static.File(rpath("themes")))
|
||||||
self.putChild("tracker", Tracker())
|
self.putChild("tracker", Tracker())
|
||||||
|
|
||||||
|
theme = component.get("DelugeWeb").config["theme"]
|
||||||
|
self.__stylesheets.insert(1, "/css/xtheme-%s.css" % theme)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def scripts(self):
|
def scripts(self):
|
||||||
return self.__scripts
|
return self.__scripts
|
||||||
|
@ -313,11 +315,13 @@ class TopLevel(resource.Resource):
|
||||||
return template.render(scripts=scripts, stylesheets=self.stylesheets)
|
return template.render(scripts=scripts, stylesheets=self.stylesheets)
|
||||||
|
|
||||||
class DelugeWeb(component.Component):
|
class DelugeWeb(component.Component):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(DelugeWeb, self).__init__("DelugeWeb")
|
super(DelugeWeb, self).__init__("DelugeWeb")
|
||||||
|
self.config = ConfigManager("web.conf", CONFIG_DEFAULTS)
|
||||||
|
|
||||||
self.top_level = TopLevel()
|
self.top_level = TopLevel()
|
||||||
self.site = server.Site(self.top_level)
|
self.site = server.Site(self.top_level)
|
||||||
self.config = ConfigManager("web.conf", CONFIG_DEFAULTS)
|
|
||||||
self.port = self.config["port"]
|
self.port = self.config["port"]
|
||||||
self.web_api = WebApi()
|
self.web_api = WebApi()
|
||||||
|
|
||||||
|
|
|
@ -55,5 +55,6 @@ class Web(_UI):
|
||||||
if self.options.port: self.server.port = self.options.port
|
if self.options.port: self.server.port = self.options.port
|
||||||
self.server.start()
|
self.server.start()
|
||||||
|
|
||||||
|
def start():
|
||||||
web = Web()
|
web = Web()
|
||||||
start = web.start
|
web.start()
|
Loading…
Reference in New Issue