webui sync 115

This commit is contained in:
Marcos Pinto 2007-10-29 20:01:37 +00:00
parent 054f7e5721
commit cf2c4a50f4
9 changed files with 34 additions and 27 deletions

View File

@ -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

View File

@ -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))

View File

@ -1 +1 @@
112
115

View File

@ -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')

View File

@ -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')
<!--$:render.part_button('POST', '/logout', _('Logout'), 'tango/system-log-out.png')-->
</div>
$:part_stats()

View File

@ -15,12 +15,12 @@ $#end
</div>
<div class="panel" id='refresh_panel'>
<a href='/config'>
<!--<a href='/config'>-->
$_('Down Speed') : $stats.download_rate ($stats.max_download)
$_('Up Speed') : $stats.upload_rate ($stats.max_upload)
</a>
<!--</a>-->
(<a href='/about'>$_('About')</a>)

View File

@ -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

View File

@ -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 = []

View File

@ -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)
#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"""