speedup srt_key sorting by sorting them in-place

This commit is contained in:
Bastien Jacquet 2015-01-05 15:45:14 +01:00
parent d426f6232e
commit f2fc776d41

View File

@ -577,7 +577,9 @@ class FlatBaseModel(GObject.GObject, Gtk.TreeModel):
# use cursor as a context manager # use cursor as a context manager
with self.gen_cursor() as cursor: with self.gen_cursor() as cursor:
#loop over database and store the sort field, and the handle #loop over database and store the sort field, and the handle
return sorted((self.sort_func(data), key) for key, data in cursor) srt_keys=[(self.sort_func(data), key) for key, data in cursor]
srt_keys.sort()
return srt_keys
def _rebuild_search(self, ignore=None): def _rebuild_search(self, ignore=None):
""" function called when view must be build, given a search text """ function called when view must be build, given a search text