From 0d5c30b5f95278dc8074c94a2f25288226969cf2 Mon Sep 17 00:00:00 2001 From: Damien Churchill Date: Wed, 1 Apr 2009 18:42:04 +0000 Subject: [PATCH] add in the file priorities to the file tree on the details tab add some icons for the priorities --- deluge/ui/web/css/deluge.css | 23 +++++++++++++++++++++++ deluge/ui/web/icons/high.png | Bin 0 -> 590 bytes deluge/ui/web/icons/highest.png | Bin 0 -> 665 bytes deluge/ui/web/icons/no_download.png | Bin 0 -> 752 bytes deluge/ui/web/icons/normal.png | Bin 0 -> 470 bytes deluge/ui/web/js/deluge-details.js | 21 +++++++++++++++++---- deluge/ui/web/js/deluge.js | 11 +++++++++++ deluge/ui/web/json_api.py | 5 ++++- 8 files changed, 55 insertions(+), 5 deletions(-) create mode 100644 deluge/ui/web/icons/high.png create mode 100644 deluge/ui/web/icons/highest.png create mode 100644 deluge/ui/web/icons/no_download.png create mode 100644 deluge/ui/web/icons/normal.png diff --git a/deluge/ui/web/css/deluge.css b/deluge/ui/web/css/deluge.css index 972888485..204a76ebf 100644 --- a/deluge/ui/web/css/deluge.css +++ b/deluge/ui/web/css/deluge.css @@ -194,4 +194,27 @@ input { .x-deluge-add-file-checkbox { margin-top: 2px; +} + +/* Filepriority styles */ +.x-no-download, .x-normal-download, .x-high-download, .x-highest-download { + padding-left: 20px; + background-repeat: no-repeat; + line-height: 16px; +} + +.x-no-download { + background-image: url(/icons/no_download.png); +} + +.x-normal-download { + background-image: url(/icons/normal.png); +} + +.x-high-download { + background-image: url(/icons/high.png); +} + +.x-highest-download { + background-image: url(/icons/highest.png); } \ No newline at end of file diff --git a/deluge/ui/web/icons/high.png b/deluge/ui/web/icons/high.png new file mode 100644 index 0000000000000000000000000000000000000000..977b9e509f002b553fc8f8909e57fbac161222a4 GIT binary patch literal 590 zcmV-U0? z=t5N?F@SVpV5r1YAu=$*fU+>LX6fFsV>@(+1OviINc^Z$5knS+PDo9Lg4)s`1{O#| z+thUu+jlGPe>_rCYN9~)s9;yjjCk6ZI!VHieySSS|bJ)Ku+SrtN9 zf^%@s)9_svn{#&t1jo(kbdbyEhp#MxGVA!=)M*4NQqQ*as!)D#jnP^`7?%HwKv^IJ zylz*^JvazZE=@4*`zJ_r3RK8yLgo=k5NNorK&vJ2q;#FV{IF4p3U9>(6oox~e49Cr zfciG<%wP}f@B2g&pxNYjbbpGyUS5w$G=Zw9ZF98SUL4)06b^fR^!j~ps)JIZ?8mPQ zxOaDg)jn@mjtJN0ldaV{JEm5rr$j&sT2;&ZcRNbfH^+ zgVRRZm@4TtPeZ!<+#1N7E|CLtRkb4EP{!HeLNuQbm4 cJO2}40NsxbZk`ICTL1t607*qoM6N<$f|&aaN&o-= literal 0 HcmV?d00001 diff --git a/deluge/ui/web/icons/highest.png b/deluge/ui/web/icons/highest.png new file mode 100644 index 0000000000000000000000000000000000000000..e383d6bc09701908005f3b48cf407257b9b0baa6 GIT binary patch literal 665 zcmV;K0%rY*P)$dz08U(OVb3eaU?9ee=GzGn$kVj`NsH4{M-ln)*{H77qwqdx~KrNfJBZ9CXaF zve}~?Lpb_TwZZ;A2q6@(kRd9#e3!T=49B?ZE2oKPV*<33-|MMJxKo~E7%L#95(z!; zfC~blqCV+KBnd>A$fF3lT@JU)=NOM;B@$y7v`z>^p`wXH{OjjXWYj7pwORq(D$lbQ z>-7o^Jo0^8Hw^3`84BQw-Mg{GJTC$IAcv69>&3vifM&A~H!m-;m+L>22n{`o1W-pN zz54wGTsIoC5~G!YAAlbOD8ixfTfp+A68rdhn+6Nr-arZHF(z1+4uygRGcy)UoiM>O z1axE!E!=GvOz2osFgss@x9>I`9)?w_X?h$ek_G3<>ihp5lG4=`);0w!oU&kJ?URG8 zS2bO?Qz0s?+{vK@^mIQ>)3HMGiC^PeCzFRlUW3~6HC1e7GByrTizB61hC`ZiDZwti_N zB10sCZi_k55cvz}I*fj2N4bWwd)({%M}PqUMkZ$iq#nGi00000NkvXXu0mjfxEUfI literal 0 HcmV?d00001 diff --git a/deluge/ui/web/icons/no_download.png b/deluge/ui/web/icons/no_download.png new file mode 100644 index 0000000000000000000000000000000000000000..7af3a5189d2fd670eaf49405e8bfe4d0070e20c1 GIT binary patch literal 752 zcmV7?#|4<_sz_{F%*kM_CJ@AZhnJ-@puvj#u|VZujfHi z>AMJ6K&fdE&!a)yKyhP*VSkmy;yc>W;X2aZE}8_vM4gH(pZhLJ7uO`|n!2+yhOQTX z&7dr{*zNbPj*hys*(`fHIk~ctN@ZxE&fyR`+uFpQ;bG6)K)@z%ZnCloM>kBXfv>Li z^^J_UbGaOQHZ`>pjmQ0pqId|r-+J{1*W6sJ+v|06X0wkp`vzE#x2d(&l}@Lbe_~?g z`oO?(bPs}VK;_xnj}udwZMK{0Q885(osn9#5solA>uDO_oih(Hk&L)0i$3 zvt%+oKOel()m3T2cvaoi>>Fr|{mdqls+HpeG*9bIW)>HNmz~bC$z3bY3rtm2(&%UK zJ{pN6Tvn@y<{jYBo4j6K4ffX8lgVI<*(@eAnFML{2GieCsc>^mjs1imPy!!=OW*+b z0G`jTuLt{TYu$&cs_ZdE36o|&NCm`G&gaKw;&EF)KC0vSp0C+#XF8wX4N@(peGHW? zNczjItxr3J!We{c8Z*$w8E_Vw(Kw4Vws4%U)nsyYKw#sz-6(Gr3hJ_=BtohhUW51} zQuu=cNZOKtv9#`k_4qv}F@0>tDX8nnKxJ$r!Pw_72-G@bF?4N!B(%A*0quoQ!uXF9 iOb1a08E6ZC1Q-C-cN`=FPt$(@0000n&vr zqzf4S|BoTb0GM;%zyHG!?&Qae+SdA ze*I_oz|IY3>nI5_tlf0}EHHW}5H}fj9x^|0O@4Tq2wjK`{UpWM^TxK644g+3#*I`EqG3!|&%; zfHEZ*1~4M$1y=0<1||)^Ga&Z=H#aBzyRmu6-&fb+^4RhXiVOZ++sMHrpmL4j$A?S* z&dmi`sR6`4p!huy|HSJ8pp!uc3PBD22Qm{0{{X7}gVz9Z06>5N01C<2jATQ61poj5 M07*qoM6N<$f-i*7RsaA1 literal 0 HcmV?d00001 diff --git a/deluge/ui/web/js/deluge-details.js b/deluge/ui/web/js/deluge-details.js index e02f08d24..921ca2ac3 100644 --- a/deluge/ui/web/js/deluge-details.js +++ b/deluge/ui/web/js/deluge-details.js @@ -232,6 +232,7 @@ Deluge.Details.Files = { text: file, // this needs to be here for sorting size: fsize(item[0]), progress: item[1], + priority: item[2], leaf: true, iconCls: 'x-deluge-file', uiProvider: Ext.tree.ColumnNodeUI @@ -298,11 +299,22 @@ function peer_address(value, p, record) { return String.format('
{1}
', seed, value); } -function peer_progress(value) { +function progress_renderer(value) { var progress = (value * 100).toInt(); return String.format(tpl, progress, '', progress); } +FILE_PRIORITY_CSS = { + 0: 'x-no-download', + 1: 'x-normal-download', + 2: 'x-high-download', + 5: 'x-highest-download' +} + +function priority_renderer(value) { + return String.format('
{1}
', FILE_PRIORITY_CSS[value], _(FILE_PRIORITY[value])); +} + function sort_address(value) { var m = value.match(/(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\:(\d+)/); var address = 0; @@ -363,11 +375,12 @@ Deluge.Details.Panel = new Ext.TabPanel({ header: _('Progress'), width: 150, dataIndex: 'progress', - renderer: peer_progress + renderer: progress_renderer },{ header: _('Priority'), width: 150, - dataIndex: 'priority' + dataIndex: 'priority', + renderer: priority_renderer }], root: new Ext.tree.TreeNode({ @@ -383,7 +396,7 @@ Deluge.Details.Panel = new Ext.TabPanel({ {header: ' ', width: 30, sortable: true, renderer: flag, dataIndex: 'country'}, {header: 'Address', width: 125, sortable: true, renderer: peer_address, dataIndex: 'address'}, {header: 'Client', width: 125, sortable: true, renderer: Deluge.Formatters.plain, dataIndex: 'client'}, - {header: 'Progress', width: 150, sortable: true, renderer: peer_progress, dataIndex: 'progress'}, + {header: 'Progress', width: 150, sortable: true, renderer: progress_renderer, dataIndex: 'progress'}, {header: 'Down Speed', width: 100, sortable: true, renderer: fspeed, dataIndex: 'downspeed'}, {header: 'Up Speed', width: 100, sortable: true, renderer: fspeed, dataIndex: 'upspeed'} ], diff --git a/deluge/ui/web/js/deluge.js b/deluge/ui/web/js/deluge.js index cede132e6..b25aae7a3 100644 --- a/deluge/ui/web/js/deluge.js +++ b/deluge/ui/web/js/deluge.js @@ -120,6 +120,17 @@ Deluge.Formatters = { } } +FILE_PRIORITY = { + 0: 'Do Not Download', + 1: 'Normal Priority', + 2: 'High Priority', + 5: 'Highest Priority', + 'Do Not Download': 0, + 'Normal Priority': 1, + 'High Priority': 2, + 'Highest Priority': 5 +} + var fsize = Deluge.Formatters.size; var fspeed = Deluge.Formatters.speed; var ftime = Deluge.Formatters.timeRemaining; diff --git a/deluge/ui/web/json_api.py b/deluge/ui/web/json_api.py index f13083678..c0c68b58a 100644 --- a/deluge/ui/web/json_api.py +++ b/deluge/ui/web/json_api.py @@ -332,6 +332,7 @@ class WebApi(JSONComponent): def _on_got_files(self, torrent, d): files = torrent.get("files") file_progress = torrent.get("file_progress") + file_priorities = torrent.get("file_priorities") paths = [] info = {} @@ -339,12 +340,14 @@ class WebApi(JSONComponent): path = torrent_file["path"] paths.append(path) torrent_file["progress"] = file_progress[index] + torrent_file["priority"] = file_priorities[index] info[path] = torrent_file def walk(path, item): if type(item) is dict: return item - return [info[path]["size"], info[path]["progress"]] + return [info[path]["size"], info[path]["progress"], + info[path]["priority"]] file_tree = uicommon.FileTree(paths) file_tree.walk(walk)