mirror of
https://github.com/codex-storage/deluge.git
synced 2025-01-12 04:24:27 +00:00
Added priority colors to torrent detail view in console
This commit is contained in:
parent
1ac62fce01
commit
4520fdd58b
@ -310,6 +310,8 @@ class TorrentDetail(BaseMode, component.Component):
|
|||||||
color_partially_selected = "magenta"
|
color_partially_selected = "magenta"
|
||||||
color_highlighted = "white"
|
color_highlighted = "white"
|
||||||
for fl in files:
|
for fl in files:
|
||||||
|
#from sys import stderr
|
||||||
|
#print >> stderr, fl[6]
|
||||||
# kick out if we're going to draw too low on the screen
|
# kick out if we're going to draw too low on the screen
|
||||||
if (off >= self.rows-1):
|
if (off >= self.rows-1):
|
||||||
self.more_to_draw = True
|
self.more_to_draw = True
|
||||||
@ -317,18 +319,34 @@ class TorrentDetail(BaseMode, component.Component):
|
|||||||
|
|
||||||
self.file_limit = idx
|
self.file_limit = idx
|
||||||
|
|
||||||
if idx >= self.file_off:
|
|
||||||
# set fg/bg colors based on if we are selected/marked or not
|
|
||||||
|
|
||||||
# default values
|
# default color values
|
||||||
fg = "white"
|
fg = "white"
|
||||||
bg = "black"
|
bg = "black"
|
||||||
|
attr = ""
|
||||||
|
|
||||||
|
if fl[6] == -2: priority = -1 #Mixed
|
||||||
|
elif fl[6] == 0:
|
||||||
|
priority = 0 #Do Not Download
|
||||||
|
fg = "red"
|
||||||
|
elif fl[6] == 1:
|
||||||
|
priority = 1 #Normal
|
||||||
|
elif fl[6] <= 6:
|
||||||
|
priority = 2 #High
|
||||||
|
fg = "yellow"
|
||||||
|
elif fl[6] == 7:
|
||||||
|
priority = 3 #Highest
|
||||||
|
fg = "green"
|
||||||
|
|
||||||
|
if idx >= self.file_off:
|
||||||
|
# set fg/bg colors based on whether the file is selected/marked or not
|
||||||
|
|
||||||
if fl[1] in self.marked:
|
if fl[1] in self.marked:
|
||||||
bg = color_selected
|
bg = color_selected
|
||||||
if fl[3]:
|
if fl[3]:
|
||||||
if self.marked[fl[1]] < self.__get_contained_files_count(file_list=fl[3]):
|
if self.marked[fl[1]] < self.__get_contained_files_count(file_list=fl[3]):
|
||||||
bg = color_partially_selected
|
bg = color_partially_selected
|
||||||
|
attr = "bold"
|
||||||
|
|
||||||
if idx == self.current_file_idx:
|
if idx == self.current_file_idx:
|
||||||
self.current_file = fl
|
self.current_file = fl
|
||||||
@ -339,9 +357,14 @@ class TorrentDetail(BaseMode, component.Component):
|
|||||||
if self.marked[fl[1]] < self.__get_contained_files_count(file_list = fl[3]):
|
if self.marked[fl[1]] < self.__get_contained_files_count(file_list = fl[3]):
|
||||||
fg = color_partially_selected
|
fg = color_partially_selected
|
||||||
else:
|
else:
|
||||||
fg = "black"
|
if fg == "white":
|
||||||
|
fg = "black"
|
||||||
|
attr = "bold"
|
||||||
|
|
||||||
color_string = "{!%s,%s!}"%(fg,bg)
|
if attr:
|
||||||
|
color_string = "{!%s,%s,%s!}"%(fg, bg, attr)
|
||||||
|
else:
|
||||||
|
color_string = "{!%s,%s!}"%(fg, bg)
|
||||||
|
|
||||||
#actually draw the dir/file string
|
#actually draw the dir/file string
|
||||||
if fl[3] and fl[4]: # this is an expanded directory
|
if fl[3] and fl[4]: # this is an expanded directory
|
||||||
|
Loading…
x
Reference in New Issue
Block a user