Re: [pygtk] GenericTreeModel problems

2002-12-31 Thread David M. Cook
On Tue, Dec 31, 2002 at 11:44:06AM +0100, Arjan J. Molenaar wrote:

> leak_references does what it says ;-): leak references. As you know, the
> TreeModel makes heavy use of iterators. One of the "not so nice" things
> about those iterators is that they get destroyed without any
> notification. leak_references == 1 will keep a reference on the Python
> object that works as the iterator. This might cause reference count
> leaks (and therefore memory leaks). when leak_references == 0, the
> Python object that works as the iterator is dereferenced (so it becomes
> a weak reference). Problem is that your tree model has to keep track of
> the iterators, otherwise you get a segmentation fault. I hope this
> explains it a little bit (I'm not in a very explainory mood today ;-).

Thanks for the further explanation.  I've added a FAQ entry on this:

http://www.async.com.br/faq/pygtk/index.py?req=all#13.20

Dave
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/



Re: [pygtk] Python does not find PyGtk

2002-12-31 Thread Martijn Brouwer
That was what I understood from the faq too, however it seems that 1.99 requires 
importation of pygtk before gtk even when only one version of pygtk is installed.
I have python 2.2 with gnome-python 1.99.13. On my system (debian testing) 
gnome-python 1.4 based on pygtk 0.69.3 is installed in combination with python 2.1. 
(in python2.1/site-packages)

On Sun, 29 Dec 2002 15:55:04 -0800
John Finlay <[EMAIL PROTECTED]> wrote:

> My understanding is that this is only required if you have both PyGTK 
> 0.6.11 and > PyGTK 1.99.13 installed together.
> Are there other circumstances where this is required?
> 
> Thanks
> 
> john
> 
> Martijn Brouwer wrote:
> 
> >On Sat, 28 Dec 2002 23:18:30 +0100
> >Tom Cato Amundsen <[EMAIL PROTECTED]> wrote:
> >
> >  
> >
> >>>ImportError: No module named gtk
> >>>
> >>>  
> >>>
> >>I guess you forgot to
> >>import pygtk
> >>pygtk.require("2.0")
> >>
> >>before "import gtk"
> >>
> >>
> >
> >No I did not forget it, I just did not know I had to. :) Now I read something about 
>it in a section of the faq I skipped because I was not upgrading from an earlier 
>version. This issue is not in John Finlay's tutorial though allthough the tutorial is 
>dated from 1 december. I will drop him a kind notice.
> >
> >Thanks for your help!
> >
> >Martijn
> >___
> >pygtk mailing list   [EMAIL PROTECTED]
> >http://www.daa.com.au/mailman/listinfo/pygtk
> >Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
> >  
> >
> 
> 
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/



Re: [pygtk] GenericTreeModel problems

2002-12-31 Thread Arjan J. Molenaar
On Sun, 2002-12-29 at 19:18, David M. Cook wrote:
> On Sun, Dec 29, 2002 at 12:25:09PM +0100, Arjan J. Molenaar wrote:
> 
> > I have no problem with the GenericTreeModel. I use it in Gaphor
> > (http://gaphor.sf.net) and even use editable cells (with an icon).
> 
> Thanks, that looks interesting.  I'm particularly curious about what the
> "leak_references" property does.  However, you only seem to have 1 column in
> your tree and some of my problems are related to having multiple columns.

leak_references does what it says ;-): leak references. As you know, the
TreeModel makes heavy use of iterators. One of the "not so nice" things
about those iterators is that they get destroyed without any
notification. leak_references == 1 will keep a reference on the Python
object that works as the iterator. This might cause reference count
leaks (and therefore memory leaks). when leak_references == 0, the
Python object that works as the iterator is dereferenced (so it becomes
a weak reference). Problem is that your tree model has to keep track of
the iterators, otherwise you get a segmentation fault. I hope this
explains it a little bit (I'm not in a very explainory mood today ;-).

> I'm getting so frustrated with it, I'm actually thinking of rewriting the
> app in Jython/Swing.

Make sure your model and view expect the same things, as I did with the
NamespaceView.

Regards,

Arjan


___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/