Ticket #317: gtkui_torrentview_update_sidebar.patch
File gtkui_torrentview_update_sidebar.patch, 2.9 KB (added by , 16 years ago) |
---|
-
deluge/ui/gtkui/torrentview.py
195 195 for torrent_id in state: 196 196 self.add_row(torrent_id) 197 197 198 self.update_filter()199 198 self.update() 200 199 201 200 def stop(self): … … 209 208 210 209 def set_filter(self, field, condition): 211 210 """Sets filters for the torrentview..""" 212 if self.filter != (None, None):213 self.filter = (None, None)214 self.update_filter()215 216 211 self.filter = (field, condition) 217 self.update_filter()218 212 self.update() 219 213 220 214 def send_status_request(self, columns=None): … … 251 245 # Create list of torrent_ids in need of status updates 252 246 torrent_ids = [] 253 247 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]]) 257 252 258 253 if torrent_ids == []: 259 254 return … … 265 260 266 261 def update_filter(self): 267 262 # Update the filter view 263 filter_column = self.columns["filter"].column_indices[0] 264 field, condition = self.filter 268 265 for row in self.liststore: 269 filter_column = self.columns["filter"].column_indices[0]270 266 # Create a function to create a new liststore with only the 271 267 # desired rows based on the filter. 272 field, condition = self.filter273 268 if field == None and condition == None: 274 269 row[filter_column] = True 275 270 continue … … 342 337 343 338 if self.status != {}: 344 339 self.update_view() 345 340 # The status of a torrent may have changed. Update the filter 341 self.update_filter() 342 346 343 def add_row(self, torrent_id): 347 344 """Adds a new torrent row to the treeview""" 348 345 # Insert a new row to the liststore … … 353 350 self.columns["torrent_id"].column_indices[0], 354 351 torrent_id) 355 352 self.update() 356 self.update_filter()357 353 358 354 def remove_row(self, torrent_id): 359 355 """Removes a row with torrent_id""" … … 362 358 self.liststore.remove(row.iter) 363 359 # Force an update of the torrentview 364 360 self.update() 365 self.update_filter()366 361 break 367 362 368 363 def get_selected_torrent(self):