Author: andar

Revision: 5425

Log:
        Optimize walk_tree() by only getting the base_path once for all siblings

Diff:
Modified: trunk/deluge/ui/gtkui/addtorrentdialog.py
===================================================================
--- trunk/deluge/ui/gtkui/addtorrentdialog.py   2009-06-27 22:13:50 UTC (rev 
5424)
+++ trunk/deluge/ui/gtkui/addtorrentdialog.py   2009-06-27 22:30:01 UTC (rev 
5425)
@@ -834,6 +834,11 @@
                 if self.files_treestore.iter_has_child(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:
                     index = self.files_treestore[row][3]
 
@@ -842,8 +847,7 @@
                         return
 
                     # Get the new full path for this file
-                    file_path = 
self.get_file_path(self.files_treestore.iter_parent(row))
-                    file_path += self.files_treestore[row][1]
+                    file_path = file_path_base + self.files_treestore[row][1]
 
                     # Update the file path in the mapped_files dict
                     self.options[torrent_id]["mapped_files"][index] = file_path



--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to