Ticket #317: gtkui_torrentview_update_sidebar.patch

File gtkui_torrentview_update_sidebar.patch, 2.9 KB (added by sadrul, 16 years ago)
  • deluge/ui/gtkui/torrentview.py

     
    195195        for torrent_id in state: 
    196196            self.add_row(torrent_id) 
    197197         
    198         self.update_filter()     
    199198        self.update() 
    200199         
    201200    def stop(self): 
     
    209208         
    210209    def set_filter(self, field, condition): 
    211210        """Sets filters for the torrentview..""" 
    212         if self.filter != (None, None): 
    213             self.filter = (None, None) 
    214             self.update_filter() 
    215          
    216211        self.filter = (field, condition) 
    217         self.update_filter() 
    218212        self.update() 
    219213     
    220214    def send_status_request(self, columns=None): 
     
    251245        # Create list of torrent_ids in need of status updates 
    252246        torrent_ids = [] 
    253247        for row in self.liststore: 
    254             # Only add this torrent_id if it's not filtered 
    255             if row[self.columns["filter"].column_indices[0]] == True: 
    256                 torrent_ids.append(row[self.columns["torrent_id"].column_indices[0]]) 
     248            # Add this torrent_id even if it is currently filtered, because 
     249            # the event that triggered this update may have made this torrent 
     250            # unfiltered 
     251            torrent_ids.append(row[self.columns["torrent_id"].column_indices[0]]) 
    257252 
    258253        if torrent_ids == []: 
    259254            return 
     
    265260     
    266261    def update_filter(self): 
    267262        # Update the filter view 
     263        filter_column = self.columns["filter"].column_indices[0] 
     264        field, condition = self.filter 
    268265        for row in self.liststore: 
    269             filter_column = self.columns["filter"].column_indices[0] 
    270266            # Create a function to create a new liststore with only the 
    271267            # desired rows based on the filter. 
    272             field, condition = self.filter 
    273268            if field == None and condition == None: 
    274269                row[filter_column] = True 
    275270                continue 
     
    342337         
    343338        if self.status != {}: 
    344339            self.update_view() 
    345          
     340            # The status of a torrent may have changed. Update the filter 
     341            self.update_filter() 
     342 
    346343    def add_row(self, torrent_id): 
    347344        """Adds a new torrent row to the treeview""" 
    348345        # Insert a new row to the liststore 
     
    353350                    self.columns["torrent_id"].column_indices[0],  
    354351                    torrent_id) 
    355352        self.update() 
    356         self.update_filter() 
    357353         
    358354    def remove_row(self, torrent_id): 
    359355        """Removes a row with torrent_id""" 
     
    362358                self.liststore.remove(row.iter) 
    363359                # Force an update of the torrentview 
    364360                self.update() 
    365                 self.update_filter() 
    366361                break 
    367362             
    368363    def get_selected_torrent(self):