[pygtk] TreeModelFilter behaves strangely with visible_func in PyGTK

mailxbox2 at o2.pl mailxbox2 at o2.pl
Fri Mar 23 00:07:47 WST 2007


Here is my problem.
I have TreeStore with data, that looks like this:

"item 0 - level 0"
	"item 0:0 - level 1"
		"item 0:0:0 - level 2"
		"item 0:0:1 - level2"
"item 1 - level 0"
	"item 1:0 - level 1"
		"item 1:0:0 - level 2"

...and so on. Depth of this tree is exactly 3.

Now I want to filter the lowest level items. Only 2nd level items, which names 
contain some substring will be visible. 0th and 1st level items will be 
visible only, when they contain some visible 2nd level items. That means: 
if "item 0:0:0" and "item 0:0:1" will be filtered out, "item 0" and "item 
0:0" should disappear as well.

The process of filtering has been solved and is not a problem here. There are 
two implementations (attached to this post): one in C, the other one in 
Python. In fact they both are supposed to work in identical way. One was 
derived from another by simply translating statements.

The problem is that while C version works as expected (hides level 0 and 1 
rows when necessary while showing level 2 rows), the Python version gives 
unpredictable results. It looks like it filters rows properly (level 0 items 
disappear when they should), but never shows level 1 and 2 items!

From these two examples it looks to me like there is some problem on Python-C 
boundary. I'm not familiar with that kind of debugging, so I ask you for 
help. Does anybody know what's the source of the problem can be? Can anybody 
either give me hints on ways of debugging such problems or take a look and 
provide exact solution?

Thank you in advance,
p_michalczyk
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tmf.cpp
Type: text/x-c++src
Size: 4980 bytes
Desc: not available
Url : http://www.daa.com.au/pipermail/pygtk/attachments/20070322/1fc932a3/tmf-0001.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tmf.py
Type: application/x-python
Size: 2819 bytes
Desc: not available
Url : http://www.daa.com.au/pipermail/pygtk/attachments/20070322/1fc932a3/tmf-0001.bin


More information about the pygtk mailing list