Re: [pygtk] MVC and TreeView

2004-06-05 Thread David M. Cook
On Fri, Jun 04, 2004 at 11:11:28PM +0100, Jonathon McKitrick wrote:
 
 Hi David,
 
 the tips you gave me were very helpful.  I have a working prototype now that
 has helped me understand the basics.  But what if I want to still have
 multiple columns?  I'm still not quite sure where those should be added or
 accounted for.

When you set the cell_data_func, you can pass in an index, and then in your
callback return different object attributes based on the index.

Dave Cook
___
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] MVC and TreeView

2004-06-04 Thread David M. Cook
On Fri, Jun 04, 2004 at 06:20:04PM +0100, Jonathon McKitrick wrote:

 if I have a set of objects and show their properties in a TreeView, is it
 better to change the original objects then rebuild the ListStore, or extract the
 changes from the ListStore and modify the original objects?

Best to avoid redundancy altogether if you can by directly using your objects.

You can put the actual objects in the ListStore and then set the cell
contents using a callback as described in the FAQ.  

http://www.async.com.br/faq/pygtk/index.py?req=showfile=faq13.029.htp

This is the easiest way to do it, but you lose interactive searches (which
must be on a text column in the TreeModel.)

Or you can write a custom TreeModel that returns values from your objects.
This is more work since you have to write all the model methods and are
responsible for sending out the right signals when the model changes.

Dave Cook
___
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] MVC and TreeView

2004-06-04 Thread Jonathon McKitrick

Actually, I figured out the last question.  But here is one that bears more
consideration.

My data is a dictionary of objects.  I use a tuple of 3 properties of those
objects in a list,  which I then sort.  Now I can iterate over the list, and
access the dict in the order I want.

How do I translate this sorting order to the TreeView or model?  Is it as
simple as setting up a method that iterates over the dict in order, and
passing that method to the TreeView?

jm
-- 
My other computer is your Windows box.
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/