Improve performance of initial torrent list load

This commit is contained in:
Andrew Resch 2008-08-15 03:50:25 +00:00
parent f4302c95ef
commit 8bebfc918e
1 changed files with 5 additions and 4 deletions

View File

@ -188,7 +188,7 @@ class TorrentView(listview.ListView, component.Component):
def _on_session_state(self, state): def _on_session_state(self, state):
for torrent_id in state: for torrent_id in state:
self.add_row(torrent_id) self.add_row(torrent_id, update=False)
self.update_filter() self.update_filter()
self.update() self.update()
@ -343,7 +343,7 @@ class TorrentView(listview.ListView, component.Component):
if self.status != {}: if self.status != {}:
self.update_view() self.update_view()
def add_row(self, torrent_id): def add_row(self, torrent_id, update=True):
"""Adds a new torrent row to the treeview""" """Adds a new torrent row to the treeview"""
# Insert a new row to the liststore # Insert a new row to the liststore
row = self.liststore.append() row = self.liststore.append()
@ -352,8 +352,9 @@ class TorrentView(listview.ListView, component.Component):
row, row,
self.columns["torrent_id"].column_indices[0], self.columns["torrent_id"].column_indices[0],
torrent_id) torrent_id)
self.update() if update:
self.update_filter() self.update()
self.update_filter()
def remove_row(self, torrent_id): def remove_row(self, torrent_id):
"""Removes a row with torrent_id""" """Removes a row with torrent_id"""