Optimize walk_tree() by only getting the base_path once for all siblings
This commit is contained in:
parent
2d379b3c67
commit
23944abc4c
|
@ -834,6 +834,11 @@ class AddTorrentDialog(component.Component):
|
||||||
if self.files_treestore.iter_has_child(row):
|
if self.files_treestore.iter_has_child(row):
|
||||||
walk_tree(self.files_treestore.iter_children(row))
|
walk_tree(self.files_treestore.iter_children(row))
|
||||||
|
|
||||||
|
# Get the file path base once, since it will be the same for
|
||||||
|
# all siblings
|
||||||
|
file_path_base = self.get_file_path(self.files_treestore.iter_parent(row))
|
||||||
|
|
||||||
|
# Iterate through all the siblings at this level
|
||||||
while row:
|
while row:
|
||||||
index = self.files_treestore[row][3]
|
index = self.files_treestore[row][3]
|
||||||
|
|
||||||
|
@ -842,8 +847,7 @@ class AddTorrentDialog(component.Component):
|
||||||
return
|
return
|
||||||
|
|
||||||
# Get the new full path for this file
|
# Get the new full path for this file
|
||||||
file_path = self.get_file_path(self.files_treestore.iter_parent(row))
|
file_path = file_path_base + self.files_treestore[row][1]
|
||||||
file_path += self.files_treestore[row][1]
|
|
||||||
|
|
||||||
# Update the file path in the mapped_files dict
|
# Update the file path in the mapped_files dict
|
||||||
self.options[torrent_id]["mapped_files"][index] = file_path
|
self.options[torrent_id]["mapped_files"][index] = file_path
|
||||||
|
|
Loading…
Reference in New Issue