Jens Geiregat wrote:

Hi all,

I'm trying to use the 'python protocol' on a TreeModelFilter, but I
keep getting the following error: "TypeError: can not set cells in
this tree model". What I'm trying to do is (i.e.)
"model[path][column]=1", with model a TreeModelFilter.

The GTK PyGTK tutorial tells me the 'python protocol' for
TreeModelFilters is not supported in versions 2.0 and 2.2, but I can't
get it to work with versions 2.6.2 and 2.8.0 too. Am I doing something
wrong? Am I trying to do something impossible? Or it this a bug?
It a limitation of the protocol support. In general it's not possible to set an individual item of a TreeModelFilter that uses set_modify_func() to install a function that generates the column values because there may not be any correspondance between the contents of the underlying TreeModel row and the filtered row. For example, the base TreeModel may contain only one column which contains strings while the TreeModelFilter may synthesize 3 columns that contain integers. Thus trying to use the protocol to set the value for column 2 in row 1 would be impossible for PyGTK to figure out.

However, since there is a one-to-one mapping of TreeModelFilter rows to the underlying TreeModel it is possible to set the value for a row but the contents have to match the column types of the base TreeModel. Using the above example you could set the row using:

treemodelfilter[0] = ["string value"]

but not:

treemodelfilter[0] = [1, 2, 3]

John


_______________________________________________
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