mirror of
https://github.com/codex-storage/deluge.git
synced 2025-01-11 12:04:10 +00:00
minor function renaming to make things properly private
This commit is contained in:
parent
12ea65d188
commit
751345fc28
@ -138,7 +138,7 @@ class TorrentDetail(BaseMode, component.Component):
|
|||||||
self.__split_help()
|
self.__split_help()
|
||||||
|
|
||||||
self.column_names = ["Filename", "Size", "Progress", "Priority"]
|
self.column_names = ["Filename", "Size", "Progress", "Priority"]
|
||||||
self._update_columns()
|
self.__update_columns()
|
||||||
|
|
||||||
component.start(["TorrentDetail"])
|
component.start(["TorrentDetail"])
|
||||||
curses.curs_set(0)
|
curses.curs_set(0)
|
||||||
@ -162,7 +162,7 @@ class TorrentDetail(BaseMode, component.Component):
|
|||||||
else:
|
else:
|
||||||
self.files_sep = "{!green,black,bold,underline!}%s"%(("Files (File list unknown)").center(self.cols))
|
self.files_sep = "{!green,black,bold,underline!}%s"%(("Files (File list unknown)").center(self.cols))
|
||||||
need_prio_update = True
|
need_prio_update = True
|
||||||
self._fill_progress(self.file_list,state["file_progress"])
|
self.__fill_progress(self.file_list,state["file_progress"])
|
||||||
for i,prio in enumerate(state["file_priorities"]):
|
for i,prio in enumerate(state["file_priorities"]):
|
||||||
if self.file_dict[i][6] != prio:
|
if self.file_dict[i][6] != prio:
|
||||||
need_prio_update = True
|
need_prio_update = True
|
||||||
@ -211,16 +211,16 @@ class TorrentDetail(BaseMode, component.Component):
|
|||||||
cur = cl
|
cur = cl
|
||||||
else:
|
else:
|
||||||
cur = cur[-1][3]
|
cur = cur[-1][3]
|
||||||
self._build_sizes(ret)
|
self.__build_sizes(ret)
|
||||||
self._fill_progress(ret,prog)
|
self.__fill_progress(ret,prog)
|
||||||
return (ret,retdict)
|
return (ret,retdict)
|
||||||
|
|
||||||
# fill in the sizes of the directory entries based on their children
|
# fill in the sizes of the directory entries based on their children
|
||||||
def _build_sizes(self, fs):
|
def __build_sizes(self, fs):
|
||||||
ret = 0
|
ret = 0
|
||||||
for f in fs:
|
for f in fs:
|
||||||
if f[2] == -1:
|
if f[2] == -1:
|
||||||
val = self._build_sizes(f[3])
|
val = self.__build_sizes(f[3])
|
||||||
ret += val
|
ret += val
|
||||||
f[2] = val
|
f[2] = val
|
||||||
else:
|
else:
|
||||||
@ -229,12 +229,12 @@ class TorrentDetail(BaseMode, component.Component):
|
|||||||
|
|
||||||
# fills in progress fields in all entries based on progs
|
# fills in progress fields in all entries based on progs
|
||||||
# returns the # of bytes complete in all the children of fs
|
# returns the # of bytes complete in all the children of fs
|
||||||
def _fill_progress(self,fs,progs):
|
def __fill_progress(self,fs,progs):
|
||||||
if not progs: return 0
|
if not progs: return 0
|
||||||
tb = 0
|
tb = 0
|
||||||
for f in fs:
|
for f in fs:
|
||||||
if f[3]: # dir, has some children
|
if f[3]: # dir, has some children
|
||||||
bd = self._fill_progress(f[3],progs)
|
bd = self.__fill_progress(f[3],progs)
|
||||||
f[5] = format_utils.format_progress((bd/f[2])*100)
|
f[5] = format_utils.format_progress((bd/f[2])*100)
|
||||||
else: # file, update own prog and add to total
|
else: # file, update own prog and add to total
|
||||||
bd = f[2]*progs[f[1]]
|
bd = f[2]*progs[f[1]]
|
||||||
@ -252,7 +252,7 @@ class TorrentDetail(BaseMode, component.Component):
|
|||||||
else:
|
else:
|
||||||
f[6] = s.pop()
|
f[6] = s.pop()
|
||||||
|
|
||||||
def _update_columns(self):
|
def __update_columns(self):
|
||||||
self.column_widths = [-1,15,15,20]
|
self.column_widths = [-1,15,15,20]
|
||||||
req = sum(filter(lambda x:x >= 0,self.column_widths))
|
req = sum(filter(lambda x:x >= 0,self.column_widths))
|
||||||
if (req > self.cols): # can't satisfy requests, just spread out evenly
|
if (req > self.cols): # can't satisfy requests, just spread out evenly
|
||||||
@ -337,7 +337,7 @@ class TorrentDetail(BaseMode, component.Component):
|
|||||||
|
|
||||||
def on_resize(self, *args):
|
def on_resize(self, *args):
|
||||||
BaseMode.on_resize_norefresh(self, *args)
|
BaseMode.on_resize_norefresh(self, *args)
|
||||||
self._update_columns()
|
self.__update_columns()
|
||||||
self.__split_help()
|
self.__split_help()
|
||||||
if self.popup:
|
if self.popup:
|
||||||
self.popup.handle_resize()
|
self.popup.handle_resize()
|
||||||
@ -465,7 +465,7 @@ class TorrentDetail(BaseMode, component.Component):
|
|||||||
self.popup.add_line("_High Priority",data=deluge.common.FILE_PRIORITY["High Priority"])
|
self.popup.add_line("_High Priority",data=deluge.common.FILE_PRIORITY["High Priority"])
|
||||||
self.popup.add_line("H_ighest Priority",data=deluge.common.FILE_PRIORITY["Highest Priority"])
|
self.popup.add_line("H_ighest Priority",data=deluge.common.FILE_PRIORITY["Highest Priority"])
|
||||||
|
|
||||||
def _mark_unmark(self,idx):
|
def __mark_unmark(self,idx):
|
||||||
if idx in self.marked:
|
if idx in self.marked:
|
||||||
del self.marked[idx]
|
del self.marked[idx]
|
||||||
else:
|
else:
|
||||||
@ -524,7 +524,7 @@ class TorrentDetail(BaseMode, component.Component):
|
|||||||
if c > 31 and c < 256:
|
if c > 31 and c < 256:
|
||||||
if chr(c) == 'm':
|
if chr(c) == 'm':
|
||||||
if self.current_file:
|
if self.current_file:
|
||||||
self._mark_unmark(self.current_file[1])
|
self.__mark_unmark(self.current_file[1])
|
||||||
elif chr(c) == 'c':
|
elif chr(c) == 'c':
|
||||||
self.marked = {}
|
self.marked = {}
|
||||||
elif chr(c) == 'a':
|
elif chr(c) == 'a':
|
||||||
|
Loading…
x
Reference in New Issue
Block a user