db: Disable incremental filtering

This applies to both the Table and child Playlists models. I'm doing my
own idle handling already for searching, so we can rely on that instead
of needing Gtk to do it. The benefit to this is that we can select
playlists programmatically during startup, since we don't need to worry
about the Table not being fully loaded yet.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
Anna Schumaker 2023-06-25 11:00:44 -04:00
parent 1d0813f217
commit a8e7078308
4 changed files with 3 additions and 4 deletions

View File

@ -55,7 +55,6 @@ class Playlist(table.Row):
self.child_set = table.TableSubset(child_table, keys=child_keys)
self.children = Gtk.FilterListModel.new(self.child_set,
child_table.get_filter())
self.children.set_incremental(True)
def do_update(self, column: str) -> bool:
"""Update a Playlist object."""

View File

@ -149,7 +149,7 @@ class Table(Gtk.FilterListModel):
filter: KeySet | None = None,
queue: Queue | None = None, **kwargs):
"""Set up our Table object."""
super().__init__(sql=sql, rows=dict(), incremental=True,
super().__init__(sql=sql, rows=dict(),
store=store.SortedList(self.get_sort_key),
filter=(filter if filter else KeySet()),
queue=(queue if queue else Queue()), **kwargs)

View File

@ -82,7 +82,7 @@ class TestPlaylistRow(unittest.TestCase):
table.get_filter())
self.assertEqual(self.playlist.children.get_model(),
self.playlist.child_set)
self.assertTrue(self.playlist.children.get_incremental())
self.assertFalse(self.playlist.children.get_incremental())
playlist2 = emmental.db.playlist.Playlist(table=self.table,
propertyid=2, name="Plist2")

View File

@ -233,7 +233,7 @@ class TestTable(tests.util.TestCase):
self.assertEqual(self.table.get_model(), self.table.store)
self.assertEqual(self.table.store.key_func, self.table.get_sort_key)
self.assertDictEqual(self.table.rows, {})
self.assertTrue(self.table.get_incremental())
self.assertFalse(self.table.get_incremental())
filter2 = emmental.db.table.KeySet()
queue2 = emmental.db.idle.Queue()