I've encountered a weird behaviour with ListStore + TreeView. The situation is
as followed (simplified a bit):
Two buttons, A and B trigger the display of two different lists in a TreeView (ListStore
model). Button A should display a rather big list (say 200 items), button B - a short
one (10 items). The ListStore is clear()'ed before the list items are appended to the
model. Now comes the funny part: if I click on A and right after that (before all items
from A are "loaded" into the TreeView) on B, I see a TreeView with two mixed lists.
Items from A on top followed by items from B. Is there any way to "lock" the TreeView
somehow, so it doesn't work like described above?
Here's the code snippet that's responsible for displaying list items:
def showHosts(self, iterator, data, hide_unused=gtk.FALSE): g = self.__gui d = self.__db treeview = g.get('hosts_treeview') # disconnect the model from treeview to ensure consistent display treeview.set_model(None) g.HostsList.clear() if hide_unused: method = d.getUsedHosts msg = 'Getting used hosts...' else: method = d.getAllHosts msg = 'Getting all hosts...' total = int(data.address.len()) g.pstart() g.pfirst(0, msg, total) for host in method(data): backgr, foregr = self.__getStatusColors(host) row = (host, host.address, host.comment, host.status[0], host.revlookup, host.timestamp, backgr, foregr) g.pstep() g.HostsList.append(row) g.pstop() # reconnect model again treeview.set_model(g.HostsList) _______________________________________________ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
