Ticket #317: gtkui_torrentview_update_sidebar_alternate.patch
File gtkui_torrentview_update_sidebar_alternate.patch, 5.3 KB (added by sadrul, 15 years ago) |
---|
-
deluge/ui/gtkui/torrentview.py
120 120 # Add the columns to the listview 121 121 self.add_text_column("torrent_id", hidden=True) 122 122 self.add_bool_column("filter", hidden=True) 123 self.add_bool_column("dirty", hidden=True) 123 124 self.add_func_column("#", cell_data_queue, [int], status_field=["queue"]) 124 125 self.add_texticon_column(_("Name"), status_field=["state", "name"], 125 126 function=cell_data_statusicon) … … 252 253 torrent_ids = [] 253 254 for row in self.liststore: 254 255 # Only add this torrent_id if it's not filtered 255 if row[self.columns["filter"].column_indices[0]] == True: 256 if row[self.columns["filter"].column_indices[0]] == True or \ 257 row[self.columns["dirty"].column_indices[0]] == True : 256 258 torrent_ids.append(row[self.columns["torrent_id"].column_indices[0]]) 259 row[self.columns["dirty"].column_indices[0]] = False 257 260 258 261 if torrent_ids == []: 259 262 return … … 266 269 def update_filter(self): 267 270 # Update the filter view 268 271 for row in self.liststore: 269 filter_column = self.columns["filter"].column_indices[0] 270 # Create a function to create a new liststore with only the 271 # desired rows based on the filter. 272 field, condition = self.filter 273 if field == None and condition == None: 274 row[filter_column] = True 275 continue 272 self.update_filter_row(row) 276 273 277 value = row[self.get_state_field_column(field)] 274 def update_filter_row(self, row): 275 filter_column = self.columns["filter"].column_indices[0] 276 # Create a function to create a new liststore with only the 277 # desired rows based on the filter. 278 field, condition = self.filter 279 if field == None and condition == None: 280 row[filter_column] = True 281 return 278 282 279 # Condition is True, so lets show this row, if not we hide it 280 if value == condition: 281 row[filter_column] = True 282 else: 283 row[filter_column] = False 284 283 value = row[self.get_state_field_column(field)] 284 285 # Condition is True, so lets show this row, if not we hide it 286 if value == condition: 287 row[filter_column] = True 288 else: 289 row[filter_column] = False 290 285 291 def update(self): 286 292 # Send a status request 287 293 self.send_status_request() … … 327 333 column_index.index(index)]] 328 334 except: 329 335 pass 330 336 self.update_filter_row(row) 331 337 # Update the toolbar buttons just in case some state has changed 332 338 component.get("ToolBar").update_buttons() 333 339 component.get("MenuBar").update_menu() … … 364 370 self.update() 365 371 self.update_filter() 366 372 break 373 374 def mark_dirty(self, torrent_id = None): 375 for row in self.liststore: 376 if not torrent_id or row[0] == torrent_id: 377 print "marking %s dirty" % torrent_id 378 row[self.columns["dirty"].column_indices[0]] = True 379 if torrent_id: break 367 380 368 381 def get_selected_torrent(self): 369 382 """Returns a torrent_id or None. If multiple torrents are selected, -
deluge/ui/gtkui/signals.py
97 97 98 98 def torrent_paused(self, torrent_id): 99 99 log.debug("torrent_paused signal received..") 100 component.get("TorrentView").mark_dirty(torrent_id) 100 101 component.get("TorrentView").update() 101 102 component.get("ToolBar").update_buttons() 102 103 component.get("MenuBar").update_menu() 103 104 104 105 def torrent_resumed(self, torrent_id): 105 106 log.debug("torrent_resumed signal received..") 107 component.get("TorrentView").mark_dirty(torrent_id) 106 108 component.get("TorrentView").update() 107 109 component.get("ToolBar").update_buttons() 108 110 component.get("MenuBar").update_menu() 109 111 110 112 def torrent_all_paused(self): 111 113 log.debug("torrent_all_paused signal received..") 114 component.get("TorrentView").mark_dirty() 112 115 component.get("TorrentView").update() 113 116 component.get("ToolBar").update_buttons() 114 117 component.get("MenuBar").update_menu() 115 118 116 119 def torrent_all_resumed(self): 117 120 log.debug("torrent_all_resumed signal received..") 121 component.get("TorrentView").mark_dirty() 118 122 component.get("TorrentView").update() 119 123 component.get("ToolBar").update_buttons() 120 124 component.get("MenuBar").update_menu() … … 126 130 127 131 def torrent_queue_changed(self): 128 132 log.debug("torrent_queue_changed signal received..") 133 component.get("TorrentView").mark_dirty() 129 134 component.get("TorrentView").update() 130 135 131 136 def torrent_resume_at_stop_ratio(self):