From 2af622b85082ba19925d55fb37b52509bf0a0680 Mon Sep 17 00:00:00 2001 From: Martijn Voncken Date: Sat, 15 Mar 2008 10:02:38 +0000 Subject: [PATCH] remove 0.5 torrent_info hacks --- deluge/ui/webui/render.py | 5 ++- .../webui/templates/advanced/part_stats.html | 2 +- .../templates/advanced/part_torrent_list.html | 18 ++++---- deluge/ui/webui/templates/deluge/index.html | 10 ++--- .../ui/webui/templates/deluge/tab_meta.html | 8 ++-- .../webui/templates/deluge/torrent_info.html | 23 +--------- .../webui/templates/white/template_style.css | 12 +++++- deluge/ui/webui/utils.py | 43 +------------------ 8 files changed, 36 insertions(+), 85 deletions(-) diff --git a/deluge/ui/webui/render.py b/deluge/ui/webui/render.py index b738e1bd8..671be34e1 100644 --- a/deluge/ui/webui/render.py +++ b/deluge/ui/webui/render.py @@ -129,7 +129,10 @@ def template_sort_head(id,name): return render.sort_column_head(id, name, order, active_up, active_down) def template_part_stats(): - return render.part_stats(get_stats()) + try: + return render.part_stats(get_stats()) + except Exception: + return '[not connected]' def get_config(var): return ws.config.get(var) diff --git a/deluge/ui/webui/templates/advanced/part_stats.html b/deluge/ui/webui/templates/advanced/part_stats.html index 4600dbc28..92ee49e4b 100644 --- a/deluge/ui/webui/templates/advanced/part_stats.html +++ b/deluge/ui/webui/templates/advanced/part_stats.html @@ -1,7 +1,7 @@ $def with (stats) -
+
diff --git a/deluge/ui/webui/templates/advanced/part_torrent_list.html b/deluge/ui/webui/templates/advanced/part_torrent_list.html index 92f6168c7..906636431 100644 --- a/deluge/ui/webui/templates/advanced/part_torrent_list.html +++ b/deluge/ui/webui/templates/advanced/part_torrent_list.html @@ -12,7 +12,7 @@ $for t in torrent_list: - $:(sort_head('calc_state_str', 'S')) + $:(sort_head('state', 'S')) $:(sort_head('queue', '#')) $:(sort_head('name', _('Name'))) $:(sort_head('total_size', _('Size'))) @@ -26,8 +26,8 @@ $for t in torrent_list: $:(sort_head('num_seeds', _('Seeders'))) $:(sort_head('num_peers', _('Peers'))) - $:(sort_head('download_rate', _('Download'))) - $:(sort_head('upload_rate', _('Upload'))) + $:(sort_head('download_payload_rate', _('Download'))) + $:(sort_head('upload_payload_rate', _('Upload'))) $:(sort_head('eta', _('Eta'))) $:(sort_head('distributed_copies', _('Ava'))) $:(sort_head('ratio', _('Ratio'))) @@ -42,7 +42,7 @@ $for torrent in torrent_list: @@ -53,7 +53,7 @@ $for torrent in torrent_list: @@ -71,14 +71,14 @@ $for torrent in torrent_list: $else: 0 diff --git a/deluge/ui/webui/templates/deluge/index.html b/deluge/ui/webui/templates/deluge/index.html index 5d2627a5c..4c192cd02 100644 --- a/deluge/ui/webui/templates/deluge/index.html +++ b/deluge/ui/webui/templates/deluge/index.html @@ -7,7 +7,7 @@ $if organize_filters:
- $torrent.message $int(torrent.progress) % + $_(torrent.state) $int(torrent.progress) %
- $if (torrent.download_rate): - $fspeed(torrent.download_rate) + $if (torrent.download_payload_rate): + $fspeed(torrent.download_payload_rate) $else:   - $if (torrent.upload_rate): - $fspeed(torrent.upload_rate) + $if (torrent.upload_payload_rate): + $fspeed(torrent.upload_payload_rate) $else:  
- $:(sort_head('calc_state_str', 'S')) + $:(sort_head('state', 'S')) $:(sort_head('queue', '#')) $:(sort_head('name', _('Name'))) $:(sort_head('total_size', _('Size'))) @@ -26,7 +26,7 @@ $for torrent in torrent_list: - - + +
$torrent.queue @@ -36,14 +36,14 @@ $for torrent in torrent_list:
- $torrent.message $int(torrent.progress) % + $_(torrent.state) $int(torrent.progress) %
$torrent.num_seeds ($torrent.total_seeds) $torrent.num_peers ($torrent.total_peers)$fspeed(torrent.download_rate)$fspeed(torrent.upload_rate)$fspeed(torrent.download_payload_rate)$fspeed(torrent.upload_payload_rate) $ftime(torrent.eta) $("%.3f" % torrent.distributed_copies) $("%.3f" % torrent.ratio) diff --git a/deluge/ui/webui/templates/deluge/tab_meta.html b/deluge/ui/webui/templates/deluge/tab_meta.html index 9055647f1..b6309f9fe 100644 --- a/deluge/ui/webui/templates/deluge/tab_meta.html +++ b/deluge/ui/webui/templates/deluge/tab_meta.html @@ -11,10 +11,10 @@ $def with (torrent) - + - + @@ -41,10 +41,10 @@ $else:
$_('Downloaded'):$torrent.calc_total_downloaded
$fsize(torrent.total_done)
$_('Uploaded'):$torrent.calc_total_uploaded$fsize(torrent.total_payload_upload)
$_('Seeders'):
+$fspeed(torrent.download_payload_rate) - + diff --git a/deluge/ui/webui/templates/deluge/torrent_info.html b/deluge/ui/webui/templates/deluge/torrent_info.html index 763a1a7e4..5b3f79472 100644 --- a/deluge/ui/webui/templates/deluge/torrent_info.html +++ b/deluge/ui/webui/templates/deluge/torrent_info.html @@ -1,6 +1,6 @@ $def with (torrent) -$:(render.header(torrent.message + '/' + torrent.name)) +$:(render.header(_(torrent.state) + '/' + torrent.name))
$for id, title, image, flag, method, url, important in toolbar_items: $if (flag > 0) and (id != 'details'): @@ -11,27 +11,6 @@ $for id, title, tab in detail_tabs: $:render[tab](torrent)
- -
$:render.footer() diff --git a/deluge/ui/webui/templates/white/template_style.css b/deluge/ui/webui/templates/white/template_style.css index ccbd9ceb9..7419ec4df 100644 --- a/deluge/ui/webui/templates/white/template_style.css +++ b/deluge/ui/webui/templates/white/template_style.css @@ -16,7 +16,9 @@ body, th, td,tr , div,table , div{ border-spacing:0px; } -a { color: #0000AA;} +a { + color: #0000AA; + } a:visited { color: #0000AA;} th {font-weight:normal} @@ -41,6 +43,14 @@ div.deluge_button{ display:inline; } +div.panel { + border-style:solid; + border-width:12 2 2 12; + border-color:#C3D9FF; + -moz-border-radius:5px; + width:700px; +} + /*page from top to bottom:*/ /*top part :*/ diff --git a/deluge/ui/webui/utils.py b/deluge/ui/webui/utils.py index 47145ce48..f16ddc6a3 100644 --- a/deluge/ui/webui/utils.py +++ b/deluge/ui/webui/utils.py @@ -149,15 +149,7 @@ def enhance_torrent_status(torrent_id,status): out: enhanced torrent_staus """ status = Storage(status) - #add missing values for deluge 0.6: - #todo : Remove this!, and clean up the rest - for key in TORRENT_KEYS: - if not key in status: - status[key] = 0 - #log.warning('torrent_status:empty key in status:%s' % key) - elif status[key] == None: - status[key] = 0 - #log.warning('torrent_status:None key in status:%s' % key) + if status.tracker == 0: #0.6 does not raise a decent error on non-existing torrent. @@ -165,45 +157,12 @@ def enhance_torrent_status(torrent_id,status): status["id"] = torrent_id - #0.5-->0.6 - status.download_rate = status.download_payload_rate - status.upload_rate = status.upload_payload_rate - - #for naming the status-images - status.calc_state_str = "downloading" - if status.paused: - status.calc_state_str= "inactive" - elif status.state <> 2: - status.calc_state_str = "seeding" - #action for torrent_pause if status.paused: #no user-paused in 0.6 !!! status.action = "start" else: status.action = "stop" - status.message = _(status.state) - - #add some pre-calculated values - status.update({ - "calc_total_downloaded" : (fsize(status.total_done) - + " (" + "??" + ")" - ), - "calc_total_uploaded": (fsize( - #status.uploaded_memory + - status.total_payload_upload) + " (" - + "??" + ")"), - }) - - #no non-unicode string may enter the templates. - #FIXED, was a translation bug.. - if debug_unicode: - for k, v in status.iteritems(): - if (not isinstance(v, unicode)) and isinstance(v, str): - try: - status[k] = unicode(v) - except: - raise Exception('Non Unicode for key:%s' % (k, )) return status def get_torrent_status(torrent_id):
$_('Speed'): -$fspeed(torrent.download_rate)
$_('Speed'):$fspeed(torrent.upload_rate)
$fspeed(torrent.upload_payload_rate)
$_('Peers'): $torrent.num_peers ($torrent.total_peers )