Use gtk.ListStore.insert

The append function of a ListStore is extremely slow.  Now I use  the
ListStore insert function, and manually track the size of the list
myself.
This commit is contained in:
Bryan Schumaker 2010-08-20 08:27:12 -04:00
parent 15cc5d22f0
commit 304855c10d
3 changed files with 3 additions and 4 deletions

View File

@ -11,7 +11,6 @@ ins_tree = None
class Collection:
def __init__(self):
self.tree = None
#self.load()
def __iter__(self):
if not self.tree:

View File

@ -28,6 +28,7 @@ class Tree(dict):
def walk(self):
keys = self.keys()
keys.sort()
keys.reverse()
get_item = self.__getitem__
for key in keys:
for track in get_item(key).walk():

View File

@ -21,11 +21,10 @@ class Collection(gtk.ScrolledWindow):
def populate(self, func):
self.list.freeze()
append = self.list.append
insert = self.list.list.insert
for track in func():
#print track
get = track.__getitem__
append([get("id"),
insert(0, [get("id"),
get("title"),
get("length"),
get("artist"),