allow recreating filter-model after adding columns
This commit is contained in:
parent
a462abb5f3
commit
f2120b1131
|
@ -171,12 +171,7 @@ class TorrentView(listview.ListView, component.Component):
|
||||||
# Set filter to None for now
|
# Set filter to None for now
|
||||||
self.filter = (None, None)
|
self.filter = (None, None)
|
||||||
|
|
||||||
# Set the liststore filter column
|
self.create_model_filter()
|
||||||
model_filter = self.liststore.filter_new()
|
|
||||||
model_filter.set_visible_column(
|
|
||||||
self.columns["filter"].column_indices[0])
|
|
||||||
self.model_filter = gtk.TreeModelSort(model_filter)
|
|
||||||
self.treeview.set_model(self.model_filter)
|
|
||||||
|
|
||||||
### Connect Signals ###
|
### Connect Signals ###
|
||||||
# Connect to the 'button-press-event' to know when to bring up the
|
# Connect to the 'button-press-event' to know when to bring up the
|
||||||
|
@ -194,6 +189,18 @@ class TorrentView(listview.ListView, component.Component):
|
||||||
# the session so we can add them to our list.
|
# the session so we can add them to our list.
|
||||||
client.get_session_state(self._on_session_state)
|
client.get_session_state(self._on_session_state)
|
||||||
|
|
||||||
|
def create_model_filter(self):
|
||||||
|
"""create new filter-model
|
||||||
|
must be called after listview.create_new_liststore
|
||||||
|
"""
|
||||||
|
# Set the liststore filter column
|
||||||
|
model_filter = self.liststore.filter_new()
|
||||||
|
model_filter.set_visible_column(
|
||||||
|
self.columns["filter"].column_indices[0])
|
||||||
|
self.model_filter = gtk.TreeModelSort(model_filter)
|
||||||
|
self.treeview.set_model(self.model_filter)
|
||||||
|
|
||||||
|
|
||||||
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)
|
||||||
|
|
Loading…
Reference in New Issue