Module: deluge Branch: master Commit: eba7c2bf17d7a7a0203029720becb10e550310cb
Author: Nick <[email protected]> Date: Wed Feb 2 12:44:07 2011 +0100 add index value to directories in file_list --- deluge/ui/console/modes/torrentdetail.py | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/deluge/ui/console/modes/torrentdetail.py b/deluge/ui/console/modes/torrentdetail.py index 5f144f6..a39c4ea 100644 --- a/deluge/ui/console/modes/torrentdetail.py +++ b/deluge/ui/console/modes/torrentdetail.py @@ -130,7 +130,8 @@ class TorrentDetail(BaseMode, component.Component): # particular directory are returned together. it won't work otherwise. # returned list is a list of lists of the form: # [file/dir_name,index,size,children,expanded,progress,priority] - # for directories index will be -1, for files the value returned in the + # for directories index values count down from maxint (for marking usage), + # for files the index is the value returned in the # state object for use with other libtorrent calls (i.e. setting prio) # # Also returns a dictionary that maps index values to the file leaves @@ -138,6 +139,7 @@ class TorrentDetail(BaseMode, component.Component): def build_file_list(self, file_tuples,prog,prio): ret = [] retdict = {} + diridx = maxint for f in file_tuples: cur = ret ps = f["path"].split("/") @@ -151,7 +153,9 @@ class TorrentDetail(BaseMode, component.Component): format_utils.format_priority(prio[f["index"]])] retdict[f["index"]] = ent else: - ent = [p,-1,-1,cl,False,"-","-"] + ent = [p,diridx,-1,cl,False,"-","-"] + retdict[diridx] = ent + diridx-=1 cur.append(ent) cur = cl else: -- 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.
