Place completed torrents after the rest regardless of sort keys(optional, on by default)

This commit is contained in:
Asmageddon 2012-05-28 00:04:58 +02:00
parent f5f1f11f61
commit 822ddc2182
2 changed files with 8 additions and 3 deletions

View File

@ -174,7 +174,8 @@ DEFAULT_PREFS = {
"third_tab_lists_all": False,
"torrents_per_tab_press": 15,
"sort_primary": "queue",
"sort_secondary": "name"
"sort_secondary": "name",
"separate_complete": True
}
column_pref_names = ["queue","name","size","state",
@ -531,6 +532,7 @@ class AllTorrents(BaseMode, component.Component):
#Sort first by secondary sort field and then primary sort field
# so it all works out
cmp_func = self._queue_sort
def sort_by_field(state, result, field):
if field in column_names_to_state_keys:
@ -538,8 +540,6 @@ class AllTorrents(BaseMode, component.Component):
reverse = field in reverse_sort_fields
cmp_func = self._queue_sort
#Get first element so we can check if it has given field
# and if it's a string
first_element = state[state.keys()[0]]
@ -566,6 +566,9 @@ class AllTorrents(BaseMode, component.Component):
result = sort_by_field(state, result, s_secondary)
result = sort_by_field(state, result, s_primary)
if self.config["separate_complete"]:
result = sorted(result, cmp_func, lambda s: state.get(s)["progress"] == 100.0)
return result
def _format_queue(self, qnum):

View File

@ -311,6 +311,8 @@ class InterfacePane(BasePane):
def __init__(self, offset, parent, width):
BasePane.__init__(self,offset,parent,width)
self.add_header("General")
self.add_checked_input("separate_complete","List complete torrents after incomplete regardless of sorting order",parent.console_config["separate_complete"])
self.add_checked_input("ignore_duplicate_lines","Do not store duplicate input in history",parent.console_config["ignore_duplicate_lines"])
self.add_checked_input("move_selection","Move selection when moving torrents in the queue",parent.console_config["move_selection"])
self.add_checked_input("third_tab_lists_all","Third tab lists all remaining torrents in legacy mode",parent.console_config["third_tab_lists_all"])