Hello.  I've noticed that whenever I set_model in my treeview it runs through every row in my generic tree model.  At first I thought this was a fixed height/column width issue but setting fixed height mode did not fix the problem.  Plus I still see this behavior even if I do not have any columns or cell renderers in my treeview.

Below is an example which I've run with gtk 2.2, 2,4 and 2.6 and seen the same thing: on_iter_next is called for each row.  To keep it simple I implemented the minimum number of methods required in the tree model to get the example to run.

Am I doing something wrong in my model?  Is this expected behavior?  Running through every row when the model is first loaded is not really practical with my actual data set.

Thanks,
Jason

class TreeModel(gtk.GenericTreeModel):
    def __init__(self, data="">         gtk.GenericTreeModel.__init__(self)
        self.data = "">     def on_get_flags(self):
        return gtk.TREE_MODEL_LIST_ONLY|gtk.TREE_MODEL_ITERS_PERSIST
    def on_get_n_columns(self):
        return 1
    def on_get_column_type(self, index):
        return int
    def on_get_iter(self, path):
        return path[0]
    def on_iter_next(self, rowref):
        print rowref,
        try:
            self.data[rowref+1]
        except IndexError:
            return None
        return rowref+1

tv = gtk.TreeView()
tv.set_model(TreeModel(range(100)))


For me this outputs:
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to