mirror of
https://github.com/codex-storage/deluge.git
synced 2025-02-17 22:06:27 +00:00
test-commit/sync to 189
This commit is contained in:
parent
a5d3444fd8
commit
806e3885b4
@ -46,11 +46,13 @@ Other contributors:
|
|||||||
*markybob : stability : synced with his changes in deluge-svn.
|
*markybob : stability : synced with his changes in deluge-svn.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
import deluge.common
|
import deluge.common
|
||||||
|
from webserver_common import ws,REVNO,VERSION
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import deluge.pref
|
import deluge.pref
|
||||||
from deluge.dialogs import show_popup_warning
|
from deluge.dialogs import show_popup_warning
|
||||||
from webserver_common import ws
|
|
||||||
except ImportError:
|
except ImportError:
|
||||||
print 'WebUi:not imported as a plugin'
|
print 'WebUi:not imported as a plugin'
|
||||||
|
|
||||||
@ -72,15 +74,8 @@ from threading import Thread
|
|||||||
import random
|
import random
|
||||||
random.seed()
|
random.seed()
|
||||||
|
|
||||||
try:
|
plugin_version += REVNO
|
||||||
plugin_version += open(os.path.join(os.path.dirname(__file__),'revno')).read()
|
plugin_description += VERSION
|
||||||
except:
|
|
||||||
plugin_version = "No Version"
|
|
||||||
try:
|
|
||||||
plugin_description += (
|
|
||||||
open(os.path.join(os.path.dirname(__file__),'version')).read())
|
|
||||||
except:
|
|
||||||
plugin_description = "No Version"
|
|
||||||
|
|
||||||
def deluge_init(deluge_path):
|
def deluge_init(deluge_path):
|
||||||
global path
|
global path
|
||||||
|
@ -35,6 +35,7 @@ from webserver_common import ws
|
|||||||
from utils import *
|
from utils import *
|
||||||
from render import render, error_page
|
from render import render, error_page
|
||||||
import page_decorators as deco
|
import page_decorators as deco
|
||||||
|
import forms
|
||||||
|
|
||||||
import lib.webpy022 as web
|
import lib.webpy022 as web
|
||||||
from lib.webpy022.http import seeother, url
|
from lib.webpy022.http import seeother, url
|
||||||
@ -63,7 +64,7 @@ urls = (
|
|||||||
"/resume_all", "resume_all",
|
"/resume_all", "resume_all",
|
||||||
"/refresh/set", "refresh_set",
|
"/refresh/set", "refresh_set",
|
||||||
"/refresh/(.*)", "refresh",
|
"/refresh/(.*)", "refresh",
|
||||||
"/config", "config_",
|
"/config", "config",
|
||||||
"/home", "home",
|
"/home", "home",
|
||||||
"/about", "about",
|
"/about", "about",
|
||||||
"/logout", "logout",
|
"/logout", "logout",
|
||||||
@ -304,33 +305,20 @@ class refresh_set:
|
|||||||
else:
|
else:
|
||||||
error_page(_('refresh must be > 0'))
|
error_page(_('refresh must be > 0'))
|
||||||
|
|
||||||
class config_: #namespace clash?
|
class config: #namespace clash?
|
||||||
"""core config
|
"""core config
|
||||||
TODO:good validation.
|
TODO:good validation.
|
||||||
"""
|
"""
|
||||||
"""
|
|
||||||
SOMEHOW ONLY BREAKS 0.6 ??
|
|
||||||
cfg_form = web.form.Form(
|
|
||||||
web.form.Dropdown('max_download',SPEED_VALUES,
|
|
||||||
description=_('Download Speed Limit'),
|
|
||||||
post='%s Kib/sec' % ws.proxy.get_config_value('max_download_speed')
|
|
||||||
)
|
|
||||||
,web.form.Dropdown('max_upload', ws.SPEED_VALUES,
|
|
||||||
description=_('Upload Speed Limit'),
|
|
||||||
post='%s Kib/sec' % ws.proxy.get_config_value('max_upload_speed')
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
@deco.deluge_page
|
@deco.deluge_page
|
||||||
def GET(self, name):
|
def GET(self, name):
|
||||||
return render.config(self.cfg_form())
|
return render.config(forms.bandwith())
|
||||||
|
|
||||||
def POST(self, name):
|
def POST(self):
|
||||||
vars = web.input(max_download=None, max_upload=None)
|
vars = web.input(max_download=None, max_upload=None)
|
||||||
|
|
||||||
#self.config.set("max_download_speed", float(str_bwdown))
|
#self.config.set("max_download_speed", float(str_bwdown))
|
||||||
raise NotImplementedError('todo')
|
raise NotImplementedError('todo')
|
||||||
"""
|
|
||||||
|
|
||||||
class home:
|
class home:
|
||||||
@deco.check_session
|
@deco.check_session
|
||||||
|
@ -44,13 +44,17 @@ class subclassed_render(object):
|
|||||||
try to use the html template in configured dir.
|
try to use the html template in configured dir.
|
||||||
not available : use template in /deluge/
|
not available : use template in /deluge/
|
||||||
"""
|
"""
|
||||||
def __init__(self, template_dirname, cache=False):
|
def __init__(self):
|
||||||
|
self.apply_cfg()
|
||||||
|
|
||||||
|
def apply_cfg(self):
|
||||||
|
cache = ws.config.get('cache_templates')
|
||||||
self.base_template = template.render(
|
self.base_template = template.render(
|
||||||
os.path.join(ws.webui_path, 'templates/deluge/'),
|
os.path.join(ws.webui_path, 'templates/deluge/'),
|
||||||
cache=cache)
|
cache=cache)
|
||||||
|
|
||||||
self.sub_template = template.render(
|
self.sub_template = template.render(
|
||||||
os.path.join(ws.webui_path, 'templates/%s/' % template_dirname),
|
os.path.join(ws.webui_path, 'templates/%s/' % ws.config.get('template')),
|
||||||
cache=cache)
|
cache=cache)
|
||||||
|
|
||||||
def __getattr__(self, attr):
|
def __getattr__(self, attr):
|
||||||
@ -59,9 +63,7 @@ class subclassed_render(object):
|
|||||||
else:
|
else:
|
||||||
return getattr(self.base_template, attr)
|
return getattr(self.base_template, attr)
|
||||||
|
|
||||||
render = subclassed_render(
|
render = subclassed_render()
|
||||||
ws.config.get('template'),
|
|
||||||
ws.config.get('cache_templates'))
|
|
||||||
|
|
||||||
def error_page(error):
|
def error_page(error):
|
||||||
web.header("Content-Type", "text/html; charset=utf-8")
|
web.header("Content-Type", "text/html; charset=utf-8")
|
||||||
|
@ -166,7 +166,7 @@ class Ws:
|
|||||||
self.log.debug('cfg-file %s' % self.config_file)
|
self.log.debug('cfg-file %s' % self.config_file)
|
||||||
|
|
||||||
if not os.path.exists(self.config_file):
|
if not os.path.exists(self.config_file):
|
||||||
self.log.debug('create cfg file %s' % config_file)
|
self.log.debug('create cfg file %s' % self.config_file)
|
||||||
#load&save defaults.
|
#load&save defaults.
|
||||||
f = file(self.config_file,'wb')
|
f = file(self.config_file,'wb')
|
||||||
pickle.dump(CONFIG_DEFAULTS,f)
|
pickle.dump(CONFIG_DEFAULTS,f)
|
||||||
@ -192,7 +192,7 @@ class Ws:
|
|||||||
#other bug: must warn if blocklist plugin is active!
|
#other bug: must warn if blocklist plugin is active!
|
||||||
from dbus_interface import get_dbus_manager
|
from dbus_interface import get_dbus_manager
|
||||||
self.proxy = get_dbus_manager()
|
self.proxy = get_dbus_manager()
|
||||||
self.config = deluge.pref.Preferences(config_file, False)
|
self.config = deluge.pref.Preferences(self.config_file, False)
|
||||||
self.env = '0.5_gtk'
|
self.env = '0.5_gtk'
|
||||||
self.init_logger()
|
self.init_logger()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user