From c1b8d6e8809bd1717f3bdd1025d4ac42ca90402c Mon Sep 17 00:00:00 2001 From: Martijn Voncken Date: Fri, 15 Feb 2008 18:11:34 +0000 Subject: [PATCH] start of torrent-move,-options,-files --- .../webui/webui_plugin/lib/newforms_plus.py | 2 + deluge/ui/webui/webui_plugin/pages.py | 12 +- deluge/ui/webui/webui_plugin/render.py | 9 +- .../webui_plugin/static/images/tango/move.png | Bin 0 -> 866 bytes .../webui_plugin/static/simple_site_style.css | 4 + .../templates/advanced/index.html | 6 + .../templates/advanced/static/advanced.css | 26 +++ .../advanced/torrent_info_inner.html | 23 ++- .../templates/deluge/tab_files.html | 15 +- .../templates/deluge/tab_meta.html | 23 ++- .../templates/deluge/tab_options.html | 19 +++ .../templates/deluge/torrent_info.html | 16 +- .../templates/deluge/torrent_move.html | 23 +++ .../webui_plugin/tests/multicall_notepad.py | 154 ++++++++++-------- deluge/ui/webui/webui_plugin/torrent_add.py | 7 +- deluge/ui/webui/webui_plugin/torrent_move.py | 74 +++++++++ .../ui/webui/webui_plugin/torrent_options.py | 54 ++++++ .../ui/webui/webui_plugin/webserver_common.py | 28 +++- 18 files changed, 391 insertions(+), 104 deletions(-) create mode 100644 deluge/ui/webui/webui_plugin/static/images/tango/move.png create mode 100644 deluge/ui/webui/webui_plugin/templates/deluge/tab_options.html create mode 100644 deluge/ui/webui/webui_plugin/templates/deluge/torrent_move.html create mode 100644 deluge/ui/webui/webui_plugin/torrent_move.py create mode 100644 deluge/ui/webui/webui_plugin/torrent_options.py diff --git a/deluge/ui/webui/webui_plugin/lib/newforms_plus.py b/deluge/ui/webui/webui_plugin/lib/newforms_plus.py index 46ba19ddf..16ef233ea 100644 --- a/deluge/ui/webui/webui_plugin/lib/newforms_plus.py +++ b/deluge/ui/webui/webui_plugin/lib/newforms_plus.py @@ -133,6 +133,8 @@ class ServerFolder(newforms.CharField): newforms.CharField.__init__(self, label=label,**kwargs) def clean(self, value): + if value == None: + value = "" value = value.rstrip('/').rstrip('\\') self.validate(value) return newforms.CharField.clean(self, value) diff --git a/deluge/ui/webui/webui_plugin/pages.py b/deluge/ui/webui/webui_plugin/pages.py index ab2f922ff..30090a5d7 100644 --- a/deluge/ui/webui/webui_plugin/pages.py +++ b/deluge/ui/webui/webui_plugin/pages.py @@ -38,6 +38,8 @@ import page_decorators as deco import config_tabs_webui #auto registers import config_tabs_deluge #auto registers from config import config_page +import torrent_options +from torrent_move import torrent_move #import forms # from debugerror import deluge_debugerror @@ -68,6 +70,7 @@ urls = ( "/torrent/reannounce/(.*)", "torrent_reannounce", "/torrent/add(.*)", "torrent_add", "/torrent/delete/(.*)", "torrent_delete", + "/torrent/move/(.*)", "torrent_move", "/torrent/queue/up/(.*)", "torrent_queue_up", "/torrent/queue/down/(.*)", "torrent_queue_down", "/pause_all", "pause_all", @@ -155,9 +158,15 @@ class torrent_info: class torrent_info_inner: @deco.deluge_page def GET(self, torrent_ids): + vars = web.input(tab = None) + if vars.tab: + active_tab = vars.tab + else: + active_tab = getcookie("torrent_info_tab") or "details" + setcookie("torrent_info_tab", active_tab) torrent_ids = torrent_ids.split(',') info = get_torrent_status(torrent_ids[0]) - return render.torrent_info_inner(info) + return render.torrent_info_inner(info, active_tab) class torrent_start: @deco.check_session @@ -219,6 +228,7 @@ class torrent_delete: ws.proxy.remove_torrent(torrent_ids, torrent_also, data_also) do_redirect() + class torrent_queue_up: @deco.check_session def POST(self, name): diff --git a/deluge/ui/webui/webui_plugin/render.py b/deluge/ui/webui/webui_plugin/render.py index d3456bce4..60aafc264 100644 --- a/deluge/ui/webui/webui_plugin/render.py +++ b/deluge/ui/webui/webui_plugin/render.py @@ -89,7 +89,7 @@ def template_crop(text, end): return "[ERROR NOT A STRING:(%s)]" % text return text -def template_crop_right(text, maxlen): +def template_crop_left(text, maxlen): try: if len(text) > maxlen: return "..." + text[-(maxlen + 3):] @@ -145,7 +145,7 @@ template.Template.globals.update({ 'part_stats':template_part_stats, 'category_tabs':category_tabs, 'crop': template_crop, - 'crop_right': template_crop_right, + 'crop_left': template_crop_left, '_': _ , #gettext/translations 'str': str, #because % in templetor is broken. 'int':int, @@ -162,7 +162,10 @@ template.Template.globals.update({ 'version': VERSION, 'getcookie':getcookie, 'get': lambda (var): getattr(web.input(**{var:None}), var), # unreadable :-( - 'env':ws.env + 'env':ws.env, + 'forms':web.Storage(), + 'enumerate':enumerate + }) #/template-defs diff --git a/deluge/ui/webui/webui_plugin/static/images/tango/move.png b/deluge/ui/webui/webui_plugin/static/images/tango/move.png new file mode 100644 index 0000000000000000000000000000000000000000..9bed1436efffee1a483904588473674318598b1f GIT binary patch literal 866 zcmeAS@N?(olHy`uVBq!ia0y~yU=RRd4mJh`2Kmqb6B!s7*pj^6T^Rm@;DWu&Co?cG za29w(7Bet#3xhBt!>l{q$DcrExPHytTpU|{Geag8W(&d<$F%`0K> zP0cISEzYb;O;N~9&d=krg##`wjbu#)BLf3t1+T>H(j*1-tjyfp#AJ1a;F8qLywoBc z1+I*ek^(DzeTal!ZfS95azBYQF?mUad!p=rf^Re#}JFtb0_(GOiq+JZvX!FALHUr=N@K9ZR?!nA**Dv zjfIy#bAro5#g-#VDUvjcVRKrg#-`?38If&I3i6iT zzW4ol;x-}O6X#!6&eK2N{{Hjhz;mTBJ1j)cg+G6`nA?Fdfc=e6VCv0j|NcgYMQvHX z|Ff5Nz2nM{-%WOwP1!kT=dUO44$17loOf5aQ@W=v^2yf=4VK>urv?3<{dVu$^7Lz> z6}PRblNavXTo^dh)TD07(+wvlIVHcf>-x0$<-Y$+k1unqyYlnvyX}v2Kc4*ZoKsM6 z<_xK+3omkhyj!94?sB-QfsL-M|9!8+OJ{$|D{}j%BE#2x{=KO8tfL9p>$(#RI;PF+ zUZs;TRf9qK@#YsZ#rB=k|5W#gIeOEY1q>W3SFU7;cw{ILY~VBb*R|+uD?VSg&ZE4$ zn3_vi*%&MC6f&tyT+Og-#*8-4^OF1wXOH(iD4f1|i-_X+WkE03Em*lwuHmui(HU)> z9e>0+ILdar)%A5}FF*D2b-lyN)eNGnqO9dJC*S@qcQGRN#KTiuMrP@2#28u*Cziw> zpBX-BN=2Dy;Gbue!o*(uSbzhAx9(cTtWuj>Fq!}BO z6i%HoTd1$8msV55Px# literal 0 HcmV?d00001 diff --git a/deluge/ui/webui/webui_plugin/static/simple_site_style.css b/deluge/ui/webui/webui_plugin/static/simple_site_style.css index 092b79eb9..87d6c2f74 100755 --- a/deluge/ui/webui/webui_plugin/static/simple_site_style.css +++ b/deluge/ui/webui/webui_plugin/static/simple_site_style.css @@ -120,4 +120,8 @@ th { background-color:none; } +h3 { + background-color:#68a; + text-align:left; +} /* Hides from IE-mac \*/ * html .clearfix {height: 1%;} .clearfix {display: block;} /* End hide from IE-mac */ diff --git a/deluge/ui/webui/webui_plugin/templates/advanced/index.html b/deluge/ui/webui/webui_plugin/templates/advanced/index.html index 5652b78d6..1812b1d05 100644 --- a/deluge/ui/webui/webui_plugin/templates/advanced/index.html +++ b/deluge/ui/webui/webui_plugin/templates/advanced/index.html @@ -50,6 +50,12 @@ $for t in torrent_list: title='$_("Details")'> + + + $:category_tabs(all_torrents) diff --git a/deluge/ui/webui/webui_plugin/templates/advanced/static/advanced.css b/deluge/ui/webui/webui_plugin/templates/advanced/static/advanced.css index bcba9c4ad..c2723b3ee 100644 --- a/deluge/ui/webui/webui_plugin/templates/advanced/static/advanced.css +++ b/deluge/ui/webui/webui_plugin/templates/advanced/static/advanced.css @@ -332,6 +332,32 @@ th.newforms { text-align:right; color:#FFFFFF; } + +a.tab_button { + color:#FFFFFF; + text-decoration:none; +} +a.tab_button:visited { + color:#FFFFFF; +} +a.tab_button:hover { + background-color:#68a; +} + +a.tab_button_active { + background-color:#900; + text-decoration:none; + color:#FFFFFF; +} +a.tab_button_active:visited { + background-color:#900; + color:#FFFFFF; +} + +h3 { + background-color:#68a; + text-align:left; +} /* Hides from IE-mac \*/ * html .clearfix {height: 1%;} .clearfix {display: block;} /* End hide from IE-mac */ diff --git a/deluge/ui/webui/webui_plugin/templates/advanced/torrent_info_inner.html b/deluge/ui/webui/webui_plugin/templates/advanced/torrent_info_inner.html index 907bfcf55..7e0d31d59 100644 --- a/deluge/ui/webui/webui_plugin/templates/advanced/torrent_info_inner.html +++ b/deluge/ui/webui/webui_plugin/templates/advanced/torrent_info_inner.html @@ -1,15 +1,22 @@ -$def with (torrent) +$def with (torrent, active_tab) - Deluge:$torrent.name - - - + - -$:render.tab_meta(torrent) -$:render.footer() +$:render.part_tab_button('details', _("Details"), active_tab) +$:render.part_tab_button('files', _("Files"), active_tab) +$:render.part_tab_button('options', _("Options"), active_tab) + +$if active_tab == 'details': + $:render.tab_meta(torrent) +$if active_tab == 'files': + $:render.tab_files(torrent) +$if active_tab == 'options': + $:render.tab_options(torrent) + + + diff --git a/deluge/ui/webui/webui_plugin/templates/deluge/tab_files.html b/deluge/ui/webui/webui_plugin/templates/deluge/tab_files.html index dfc0c1b77..5567f12f9 100644 --- a/deluge/ui/webui/webui_plugin/templates/deluge/tab_files.html +++ b/deluge/ui/webui/webui_plugin/templates/deluge/tab_files.html @@ -4,6 +4,17 @@ $def with (torrent) $altrow(True) -$for file in torrent.files: - +$for i, file in enumerate(torrent.files): + + +
$_("File")$_("Size")
$(crop_right(file["path"], 70))$fsize(file["size"])
+ +$(crop_left(file["path"], 70)) + +$fsize(file["size"])
+ +
Save/update: Todo
diff --git a/deluge/ui/webui/webui_plugin/templates/deluge/tab_meta.html b/deluge/ui/webui/webui_plugin/templates/deluge/tab_meta.html index 4f53e23c4..c3fc0b866 100644 --- a/deluge/ui/webui/webui_plugin/templates/deluge/tab_meta.html +++ b/deluge/ui/webui/webui_plugin/templates/deluge/tab_meta.html @@ -27,8 +27,13 @@ $def with (torrent) $torrent.num_pieces x $fsize(torrent.piece_length) -  -  +$_('Allocation'): + +$if torrent.compact: + $_('Compact') +$else: + $_('Full') + @@ -50,10 +55,11 @@ $fspeed(torrent.download_rate) $_('Availability'): $("%.3f" % torrent.distributed_copies) -  -  +$_('Queue Position'): +$torrent.queue_pos + @@ -68,17 +74,16 @@ $fspeed(torrent.download_rate) $torrent.num_files $_('Tracker'): -$(crop(torrent.tracker, 30)) +$(crop(torrent.tracker, 25)) $_('Tracker Status'): -$(crop(torrent.tracker_status, 30)) +$(crop(torrent.tracker_status, 25)) $_('Next Announce'): $torrent.next_announce - -$_('Queue Position'): -$torrent.queue_pos +$('Save Path'): +$crop_left(torrent.save_path, 25) diff --git a/deluge/ui/webui/webui_plugin/templates/deluge/tab_options.html b/deluge/ui/webui/webui_plugin/templates/deluge/tab_options.html new file mode 100644 index 000000000..8a3bd03ca --- /dev/null +++ b/deluge/ui/webui/webui_plugin/templates/deluge/tab_options.html @@ -0,0 +1,19 @@ +$def with (torrent) +
+
+ + $:(forms.torrent_options(torrent).as_table(["max_download_speed", "max_upload_speed", "max_connections", "max_upload_slots"])) + + +
+
+ + + $:(forms.torrent_options(torrent).as_table(["prioritize_first_last", "private"])) + +
+ +
+
Save/update: Todo
+
+ diff --git a/deluge/ui/webui/webui_plugin/templates/deluge/torrent_info.html b/deluge/ui/webui/webui_plugin/templates/deluge/torrent_info.html index e0cd572c2..c8a1e63b9 100644 --- a/deluge/ui/webui/webui_plugin/templates/deluge/torrent_info.html +++ b/deluge/ui/webui/webui_plugin/templates/deluge/torrent_info.html @@ -3,9 +3,6 @@ $def with (torrent) $:(render.header(torrent.message + '/' + torrent.name))
-

$_('Details')

-$:render.tab_meta(torrent) - $if (torrent.action == 'start'): $:render.part_button('POST', '/torrent/start/' + str(torrent.id), _('Resume'), 'tango/start.png') $else: @@ -18,9 +15,20 @@ $:render.part_button('POST', '/torrent/reannounce/' + str(torrent.id), _('Reanno $:render.part_button('POST', '/torrent/queue/up/' + str(torrent.id), _('Queue Up'), 'tango/queue-up.png') $:render.part_button('POST', '/torrent/queue/down/' + str(torrent.id), _('Queue Down'), 'tango/queue-down.png') -
+$:render.part_button('GET', '/torrent/move/' + str(torrent.id), _('Move'), 'tango/move.png') + +

$_('Details')

+$:render.tab_meta(torrent) + + +

$_('Files')

+ $:render.tab_files(torrent) +

$_('Options')

+ +$:render.tab_options(torrent) +
+
not working yet, but close..
+ +$:form.as_table() + + + + +
+$:render.footer() \ No newline at end of file diff --git a/deluge/ui/webui/webui_plugin/tests/multicall_notepad.py b/deluge/ui/webui/webui_plugin/tests/multicall_notepad.py index 032633060..07a7b5066 100644 --- a/deluge/ui/webui/webui_plugin/tests/multicall_notepad.py +++ b/deluge/ui/webui/webui_plugin/tests/multicall_notepad.py @@ -7,82 +7,100 @@ from WebUi.webserver_common import ws ws.init_06() async_proxy = ws.async_proxy - - -# -#A: translate this into 1 multicall: - -start = time.time() -stats = { - 'download_rate':ws.proxy.get_download_rate(), - 'upload_rate':ws.proxy.get_upload_rate(), - 'max_download':ws.proxy.get_config_value('max_download_speed'), - 'max_upload':ws.proxy.get_config_value('max_upload_speed'), - 'num_connections':ws.proxy.get_num_connections(), - 'max_num_connections':ws.proxy.get_config_value('max_connections_global') -} - -print "sync-stats:",time.time() - start - -print stats - -# -#map callback to a a dict-setter -def dict_cb(key,d): - def callback(result): - d[key] = result - return callback - -start = time.time() -d = {} -async_proxy.get_download_rate(dict_cb('download_rate',d)) -async_proxy.get_upload_rate(dict_cb('upload_rate',d)) -async_proxy.get_config_value(dict_cb('max_download',d),"max_download_speed") -async_proxy.get_config_value(dict_cb('max_upload',d),"max_upload_speed") -async_proxy.get_num_connections(dict_cb("num_connections",d)) -async_proxy.get_config_value(dict_cb('max_num_connections',d),"max_connections_global") - -async_proxy.force_call(block=True) - -print "Async-stats:",time.time() - start -print d - -# -#B: translate this to multicall: -# - -#old-sync: -start = time.time() - -torrent_list = [ws.proxy.get_torrent_status(id,[]) - for id in ws.proxy.get_session_state() +TORRENT_KEYS = ['name', 'total_size', 'num_files', 'num_pieces', 'piece_length', + 'eta', 'ratio', 'file_progress', 'distributed_copies', 'total_done', + 'total_uploaded', 'state', 'paused', 'progress', 'next_announce', + 'total_payload_download', 'total_payload_upload', 'download_payload_rate', + 'upload_payload_rate', 'num_peers', 'num_seeds', 'total_peers', 'total_seeds', + 'total_wanted', 'tracker', 'trackers', 'tracker_status', 'save_path', + 'files', 'file_priorities', 'compact', 'max_connections', + 'max_upload_slots', 'max_download_speed', 'prioritize_first_last', 'private' ] -print "sync-list:",time.time() - start -print torrent_list - -#new async: - -start = time.time() - -torrent_ids = ws.proxy.get_session_state() #Syc-api. -torrent_dict = {} -for id in torrent_ids: - async_proxy.get_torrent_status(dict_cb(id,torrent_dict), id, []) -async_proxy.force_call(block=True) - -print "Async-list:",time.time() - start -print "\n".join(torrent_dict[torrent_ids[0]].keys()) -print torrent_dict[torrent_ids[0]]["files"] - - - +if False: + # + #A: translate this into 1 multicall: + + start = time.time() + stats = { + 'download_rate':ws.proxy.get_download_rate(), + 'upload_rate':ws.proxy.get_upload_rate(), + 'max_download':ws.proxy.get_config_value('max_download_speed'), + 'max_upload':ws.proxy.get_config_value('max_upload_speed'), + 'num_connections':ws.proxy.get_num_connections(), + 'max_num_connections':ws.proxy.get_config_value('max_connections_global') + } + + print "sync-stats:",time.time() - start + + print stats + + # + #map callback to a a dict-setter + def dict_cb(key,d): + def callback(result): + d[key] = result + return callback + + start = time.time() + d = {} + async_proxy.get_download_rate(dict_cb('download_rate',d)) + async_proxy.get_upload_rate(dict_cb('upload_rate',d)) + async_proxy.get_config_value(dict_cb('max_download',d),"max_download_speed") + async_proxy.get_config_value(dict_cb('max_upload',d),"max_upload_speed") + async_proxy.get_num_connections(dict_cb("num_connections",d)) + async_proxy.get_config_value(dict_cb('max_num_connections',d),"max_connections_global") + + async_proxy.force_call(block=True) + + print "Async-stats:",time.time() - start + print d + + # + #B: translate this to multicall: + # + + #old-sync: + start = time.time() + + torrent_list = [ws.proxy.get_torrent_status(id, TORRENT_KEYS ) + for id in ws.proxy.get_session_state() + ] + + print "sync-list:",time.time() - start + print torrent_list[0] + + #new async: + """ + torrent.compact, + torrent.max_connections, + torrent.max_upload_slots, + torrent.max_upload_speed, + torrent.max_download_speed, + torrent.prioritize_first_last, + torrent.private + """ + start = time.time() + torrent_ids = ws.proxy.get_session_state() #Syc-api. + torrent_dict = {} + for id in torrent_ids: + async_proxy.get_torrent_status(dict_cb(id,torrent_dict), id, TORRENT_KEYS ) + async_proxy.force_call(block=True) + print "Async-list:",time.time() - start + print "\n".join(torrent_dict[torrent_ids[0]].keys()) + print torrent_dict[torrent_ids[0]] +if False: + print ws.proxy.get_config_value('download_location') +if True: + torrent_id = ws.proxy.get_session_state()[0] + print torrent_id + ws.proxy.move_torrent([torrent_id],"/media/sdb1/test") \ No newline at end of file diff --git a/deluge/ui/webui/webui_plugin/torrent_add.py b/deluge/ui/webui/webui_plugin/torrent_add.py index 6a996ca39..e9b262b91 100644 --- a/deluge/ui/webui/webui_plugin/torrent_add.py +++ b/deluge/ui/webui/webui_plugin/torrent_add.py @@ -70,7 +70,12 @@ class AddForm(forms.Form): class torrent_add: def add_page(self,error = None): - form_data = utils.get_newforms_data(AddForm) + #form_data = utils.get_newforms_data(AddForm) + + #TODO: CLEANUP!!! + vars = web.input(url = None) + form_data = {'url':vars.url} + options_data = None if error: options_data = utils.get_newforms_data(OptionsForm) diff --git a/deluge/ui/webui/webui_plugin/torrent_move.py b/deluge/ui/webui/webui_plugin/torrent_move.py new file mode 100644 index 000000000..e6f4174c1 --- /dev/null +++ b/deluge/ui/webui/webui_plugin/torrent_move.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Copyright (C) Martijn Voncken 2008 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, write to: +# The Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor +# Boston, MA 02110-1301, USA. +# +# In addition, as a special exception, the copyright holders give +# permission to link the code of portions of this program with the OpenSSL +# library. +# You must obey the GNU General Public License in all respects for all of +# the code used other than OpenSSL. If you modify file(s) with this +# exception, you may extend this exception to your version of the file(s), +# 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 +# statement from all source files in the program, then also delete it here. +# + +from webserver_common import ws +import utils +from render import render +import page_decorators as deco +import lib.newforms_plus as forms +import lib.webpy022 as web + +#Too much boilerplate code here, todo : fix it. + +class MoveForm(forms.Form): + save_path = forms.ServerFolder(_("Move To")) + def initial_data(self): + return {'save_path':ws.proxy.get_config_value('download_location')} + +class torrent_move: + + def move_page(self, name, error = None): + torrent_ids = name.split(',') + torrent_list = [utils.get_torrent_status(id) for id in torrent_ids] + + data = None + if error: + data = utils.get_newforms_data(MoveForm) + + form = MoveForm(data) + + return render.torrent_move(name, torrent_list , form, error) + + @deco.deluge_page + def GET(self, name): + return self.move_page(name) + + @deco.check_session + def POST(self, name): + torrent_ids = name.split(',') + form = MoveForm(utils.get_newforms_data(MoveForm)) + if not form.is_valid(): + print self.move_page(name, error = _("Error in Path.")) + return + save_path = form.clean_data["save_path"] + ws.proxy.move_torrent(torrent_ids, save_path) + utils.do_redirect() diff --git a/deluge/ui/webui/webui_plugin/torrent_options.py b/deluge/ui/webui/webui_plugin/torrent_options.py new file mode 100644 index 000000000..24704f791 --- /dev/null +++ b/deluge/ui/webui/webui_plugin/torrent_options.py @@ -0,0 +1,54 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Copyright (C) Martijn Voncken 2008 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, write to: +# The Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor +# Boston, MA 02110-1301, USA. +# +# In addition, as a special exception, the copyright holders give +# permission to link the code of portions of this program with the OpenSSL +# library. +# You must obey the GNU General Public License in all respects for all of +# the code used other than OpenSSL. If you modify file(s) with this +# exception, you may extend this exception to your version of the file(s), +# 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 +# statement from all source files in the program, then also delete it here. +# +from webserver_common import ws +import utils +from render import template +import page_decorators as deco +import lib.newforms_plus as forms +import lib.webpy022 as web + +class TorrentOptionsForm(forms.Form): + +#download + max_download_speed = forms.DelugeFloat( + _("Maximum Down Speed")) + max_upload_speed = forms.DelugeFloat( + _("Maximum Up Speed")) + max_connections = forms.DelugeInt(_("Maximum Connections")) + max_upload_slots = forms.DelugeInt(_("Maximum Upload Slots")) + #general + prioritize_first_last = forms.CheckBox( + _('Prioritize first and last pieces')) + private = forms.CheckBox(_('Private Flag')) + +template.Template.globals["forms"].torrent_options = lambda torrent : TorrentOptionsForm(torrent) + diff --git a/deluge/ui/webui/webui_plugin/webserver_common.py b/deluge/ui/webui/webui_plugin/webserver_common.py index 020224a02..c2246262e 100644 --- a/deluge/ui/webui/webui_plugin/webserver_common.py +++ b/deluge/ui/webui/webui_plugin/webserver_common.py @@ -64,14 +64,26 @@ try: except: VERSION = '' -TORRENT_KEYS = ['distributed_copies', 'download_payload_rate', - 'eta', 'is_seed', 'name', 'next_announce', - 'num_files', 'num_peers', 'num_pieces', 'num_seeds', 'paused', - 'piece_length','progress', 'ratio', 'total_done', 'total_download', - 'total_payload_download', 'total_payload_upload', 'total_peers', - 'total_seeds', 'total_size', 'total_upload', 'total_wanted', - 'tracker_status', 'upload_payload_rate', - 'uploaded_memory','tracker','state','queue_pos','user_paused','files'] + +TORRENT_KEYS = ['name', 'total_size', 'num_files', 'num_pieces', 'piece_length', + 'eta', 'ratio', 'file_progress', 'distributed_copies', 'total_done', + 'total_uploaded', 'state', 'paused', 'progress', 'next_announce', + 'total_payload_download', 'total_payload_upload', 'download_payload_rate', + 'upload_payload_rate', 'num_peers', 'num_seeds', 'total_peers', 'total_seeds', + 'total_wanted', 'tracker', 'trackers', 'tracker_status', 'save_path', + 'files', 'file_priorities', 'compact', 'max_connections', + 'max_upload_slots', 'max_download_speed', 'prioritize_first_last', + 'private','max_upload_speed', + + #REMOVE: + "is_seed","total_download","total_upload","uploaded_memory","queue_pos", + "user_paused" + + ] +""" +NOT:is_seed,total_download,total_upload,uploaded_memory,queue_pos,user_paused +""" + STATE_MESSAGES = (_("Queued"), _("Checking"),