Changeset 3761

Show
Ignore:
Timestamp:
08/26/08 23:00:12 (4 months ago)
Author:
andar
Message:

Fix setting file priorities on folders

Files:
3 modified

Legend:

Unmodified
Added
Removed
  • branches/1.0.0_RC/ChangeLog

    r3760 r3761  
    99 GtkUI: 
    1010  * Sort filenames alphabetically in add torrent dialog 
     11  * Fix setting file priorities on folders 
    1112   
    1213Deluge 0.9.07 - "1.0.0_RC7" (18 August 2008) 
  • branches/1.0.0_RC/deluge/ui/gtkui/files_tab.py

    r3726 r3761  
    344344    def get_selected_files(self): 
    345345        """Returns a list of file indexes that are selected""" 
     346        def get_iter_children(itr, selected): 
     347            i = self.treestore.iter_children(itr) 
     348            while i: 
     349                selected.append(self.treestore[i][5]) 
     350                if self.treestore.iter_has_child(i): 
     351                    get_selected_files(i, selected) 
     352                i = self.treestore.iter_next(i) 
     353                     
    346354        selected = [] 
    347355        paths = self.listview.get_selection().get_selected_rows()[1] 
    348356        for path in paths: 
    349             selected.append(self.treestore.get_value(self.treestore.get_iter(path), 5)) 
    350  
     357            i = self.treestore.get_iter(path) 
     358            selected.append(self.treestore[i][5]) 
     359            if self.treestore.iter_has_child(i): 
     360                get_iter_children(i, selected) 
     361                 
    351362        return selected 
    352              
     363 
    353364    def _on_get_torrent_files(self, status): 
    354365        self.files_list[self.torrent_id] = status["files"] 
     
    406417        def set_file_priority(model, path, iter, data): 
    407418            index = model.get_value(iter, 5) 
    408             if index in selected: 
     419            if index in selected and index != -1: 
    409420                file_priorities.append((index, priority)) 
    410421            elif index != -1: 
  • trunk/deluge/ui/gtkui/files_tab.py

    r3726 r3761  
    344344    def get_selected_files(self): 
    345345        """Returns a list of file indexes that are selected""" 
     346        def get_iter_children(itr, selected): 
     347            i = self.treestore.iter_children(itr) 
     348            while i: 
     349                selected.append(self.treestore[i][5]) 
     350                if self.treestore.iter_has_child(i): 
     351                    get_selected_files(i, selected) 
     352                i = self.treestore.iter_next(i) 
     353                     
    346354        selected = [] 
    347355        paths = self.listview.get_selection().get_selected_rows()[1] 
    348356        for path in paths: 
    349             selected.append(self.treestore.get_value(self.treestore.get_iter(path), 5)) 
    350  
     357            i = self.treestore.get_iter(path) 
     358            selected.append(self.treestore[i][5]) 
     359            if self.treestore.iter_has_child(i): 
     360                get_iter_children(i, selected) 
     361                 
    351362        return selected 
    352363             
     
    406417        def set_file_priority(model, path, iter, data): 
    407418            index = model.get_value(iter, 5) 
    408             if index in selected: 
     419            if index in selected and index != -1: 
    409420                file_priorities.append((index, priority)) 
    410421            elif index != -1: