From cf2c4a50f490ca16558d583665485fd46f7e632e Mon Sep 17 00:00:00 2001 From: Marcos Pinto Date: Mon, 29 Oct 2007 20:01:37 +0000 Subject: [PATCH] webui sync 115 --- plugins/WebUi/__init__.py | 6 +++--- plugins/WebUi/deluge_webserver.py | 11 +++++------ plugins/WebUi/revno | 2 +- plugins/WebUi/scripts/template_strings.py | 3 +++ plugins/WebUi/templates/deluge/index.html | 2 +- .../WebUi/templates/deluge/part_stats.html | 4 ++-- plugins/WebUi/version | 6 +++--- plugins/WebUi/webserver_common.py | 8 ++++---- plugins/WebUi/webserver_framework.py | 19 ++++++++++++------- 9 files changed, 34 insertions(+), 27 deletions(-) diff --git a/plugins/WebUi/__init__.py b/plugins/WebUi/__init__.py index 497fe5f0b..d4548b990 100644 --- a/plugins/WebUi/__init__.py +++ b/plugins/WebUi/__init__.py @@ -28,10 +28,10 @@ # but you are not obligated to do so. If you do not wish to do so, delete # this exception statement from your version. If you delete this exception -plugin_name = _("Web User Interface") +plugin_name = "Web User Interface" plugin_author = "Martijn Voncken" plugin_version = "rev." -plugin_description = _("""A Web based User Interface +plugin_description = """A Web based User Interface Firefox greasemonkey script: http://userscripts.org/scripts/show/12639 @@ -42,7 +42,7 @@ There is support for multiple templates, but just one is included. Other contributors: *somedude : template enhancements. *markybob : stability : synced with his changes in deluge-svn. -""") +""" import deluge.common import deluge.pref diff --git a/plugins/WebUi/deluge_webserver.py b/plugins/WebUi/deluge_webserver.py index 4c989dccb..f2ccd43b5 100644 --- a/plugins/WebUi/deluge_webserver.py +++ b/plugins/WebUi/deluge_webserver.py @@ -59,16 +59,15 @@ urls = ( "/home(.*)", "home", "/about(.*)", "about", "/logout(.*)", "logout", - #default-pages - "/", "home", - "", "home", #remote-api: "/remote/torrent/add(.*)", "remote_torrent_add", #static: "/static/(.*)","static", "/template/static/(.*)","template_static", #"/downloads/(.*)","downloads" disabled until it can handle large downloads. - + #default-pages + "/(.*)", "home", + "(.*)", "home" ) #/routing @@ -93,8 +92,8 @@ class login: class index: "page containing the torrent list." - @auto_refreshed @deluge_page + @auto_refreshed def GET(self, name): vars = web.input(sort=None, order=None) @@ -113,8 +112,8 @@ class index: return ws.render.index(status_rows) class torrent_info: - @auto_refreshed @deluge_page + @auto_refreshed def GET(self, torrent_id): return ws.render.torrent_info(get_torrent_status(torrent_id)) diff --git a/plugins/WebUi/revno b/plugins/WebUi/revno index 194b81caa..ee977b5ec 100644 --- a/plugins/WebUi/revno +++ b/plugins/WebUi/revno @@ -1 +1 @@ -112 +115 diff --git a/plugins/WebUi/scripts/template_strings.py b/plugins/WebUi/scripts/template_strings.py index e578b380b..8512c1788 100644 --- a/plugins/WebUi/scripts/template_strings.py +++ b/plugins/WebUi/scripts/template_strings.py @@ -1,11 +1,13 @@ _('# Of Files') _('About') +_('Apply') _('Auto refresh:') _('Availability') _('Debug:Data Dump') _('Delete .torrent file') _('Delete downloaded files.') _('Details') +_('Down Speed') _('Downloaded') _('ETA') _('Next Announce') @@ -24,6 +26,7 @@ _('Submit') _('Total Size') _('Tracker') _('Tracker Status') +_('Up Speed') _('Upload torrent') _('Uploaded') _('Url') diff --git a/plugins/WebUi/templates/deluge/index.html b/plugins/WebUi/templates/deluge/index.html index fb502868b..b177c7b8c 100644 --- a/plugins/WebUi/templates/deluge/index.html +++ b/plugins/WebUi/templates/deluge/index.html @@ -51,7 +51,7 @@ $for torrent in torrent_list: $:render.part_button('GET', '/torrent/add', _('Add torrent'), 'tango/list-add.png') $:render.part_button('POST', '/pause_all', _('Pause all'), 'tango/media-playback-pause.png') $:render.part_button('POST', '/resume_all', _('Resume all'), 'tango/media-playback-start.png') -$:render.part_button('POST', '/logout', _('Logout'), 'tango/system-log-out.png') + $:part_stats() diff --git a/plugins/WebUi/templates/deluge/part_stats.html b/plugins/WebUi/templates/deluge/part_stats.html index 4150a0f36..0a212b8cf 100644 --- a/plugins/WebUi/templates/deluge/part_stats.html +++ b/plugins/WebUi/templates/deluge/part_stats.html @@ -15,12 +15,12 @@ $#end
- + $_('Down Speed') : $stats.download_rate ($stats.max_download) $_('Up Speed') : $stats.upload_rate ($stats.max_upload) - + ($_('About')) diff --git a/plugins/WebUi/version b/plugins/WebUi/version index 004ed9c81..70d0afd63 100644 --- a/plugins/WebUi/version +++ b/plugins/WebUi/version @@ -1,5 +1,5 @@ revision-id: mvoncken@gmail.com-20070930083408-sv8mo0mi1rbjnfvk -date: 2007-10-23 15:10:08 +0200 -build-date: 2007-10-23 15:34:50 +0200 -revno: 112 +date: 2007-10-29 15:10:08 +0200 +build-date: 2007-10-29 15:34:50 +0200 +revno: 115 branch-nick: WebUi diff --git a/plugins/WebUi/webserver_common.py b/plugins/WebUi/webserver_common.py index dd932c681..0e7733261 100644 --- a/plugins/WebUi/webserver_common.py +++ b/plugins/WebUi/webserver_common.py @@ -156,10 +156,10 @@ COOKIE_DEFAULTS = { 'auto_refresh_secs':'10' } -try: - SESSIONS = pickle.load(open(session_file)) -except: - SESSIONS = [] +#try: +# SESSIONS = pickle.load(open(session_file)) +#except: +SESSIONS = [] diff --git a/plugins/WebUi/webserver_framework.py b/plugins/WebUi/webserver_framework.py index 37b8497b0..46df1a8bc 100644 --- a/plugins/WebUi/webserver_framework.py +++ b/plugins/WebUi/webserver_framework.py @@ -75,18 +75,23 @@ def setcookie(key, val): def start_session(): session_id = str(random.random()) ws.SESSIONS.append(session_id) - if len(ws.SESSIONS) > 20: #save max 20 sessions? - ws.SESSIONS = ws.SESSIONS[-20:] + #if len(ws.SESSIONS) > 20: #save max 20 sessions? + # ws.SESSIONS = ws.SESSIONS[-20:] #not thread safe! , but a verry rare bug. - pickle.dump(ws.SESSIONS, open(ws.session_file,'wb')) + #f = open(ws.session_file,'wb') + #pickle.dump(ws.SESSIONS, f) + #f.close() setcookie("session_id", session_id) def end_session(): - session_id = getcookie("session_id") - if session_id in ws.SESSIONS: - ws.SESSIONS.remove(session_id) + session_id = getcookie("session_id") + #if session_id in ws.SESSIONS: + # ws.SESSIONS.remove(session_id) #not thread safe! , but a verry rare bug. - pickle.dump(ws.SESSIONS, open(ws.session_file,'wb')) + #f = open(ws.session_file,'wb') + #pickle.dump(ws.SESSIONS, f) + #f.close() + setcookie("session_id","") def do_redirect(): """for redirects after a POST"""