Author: damoxc
Revision: 4966
Log:
add in the file priorities to the file tree on the details tab
add some icons for the priorities
Diff:
Modified: trunk/deluge/ui/web/css/deluge.css
===================================================================
--- trunk/deluge/ui/web/css/deluge.css 2009-04-01 16:33:31 UTC (rev 4965)
+++ trunk/deluge/ui/web/css/deluge.css 2009-04-01 18:42:04 UTC (rev 4966)
@@ -194,4 +194,27 @@
.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
Added: trunk/deluge/ui/web/icons/high.png
===================================================================
(Binary files differ)
Property changes on: trunk/deluge/ui/web/icons/high.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/deluge/ui/web/icons/highest.png
===================================================================
(Binary files differ)
Property changes on: trunk/deluge/ui/web/icons/highest.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/deluge/ui/web/icons/no_download.png
===================================================================
(Binary files differ)
Property changes on: trunk/deluge/ui/web/icons/no_download.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/deluge/ui/web/icons/normal.png
===================================================================
(Binary files differ)
Property changes on: trunk/deluge/ui/web/icons/normal.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: trunk/deluge/ui/web/js/deluge-details.js
===================================================================
--- trunk/deluge/ui/web/js/deluge-details.js 2009-04-01 16:33:31 UTC (rev
4965)
+++ trunk/deluge/ui/web/js/deluge-details.js 2009-04-01 18:42:04 UTC (rev
4966)
@@ -232,6 +232,7 @@
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 @@
return String.format('<div class="{0}">{1}</div>', 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('<div class="{0}">{1}</div>',
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 @@
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 @@
{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'}
],
Modified: trunk/deluge/ui/web/js/deluge.js
===================================================================
--- trunk/deluge/ui/web/js/deluge.js 2009-04-01 16:33:31 UTC (rev 4965)
+++ trunk/deluge/ui/web/js/deluge.js 2009-04-01 18:42:04 UTC (rev 4966)
@@ -120,6 +120,17 @@
}
}
+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;
Modified: trunk/deluge/ui/web/json_api.py
===================================================================
--- trunk/deluge/ui/web/json_api.py 2009-04-01 16:33:31 UTC (rev 4965)
+++ trunk/deluge/ui/web/json_api.py 2009-04-01 18:42:04 UTC (rev 4966)
@@ -332,6 +332,7 @@
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 @@
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)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"deluge-commit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/deluge-commit?hl=en
-~----------~----~----~----~------~----~------~--~---