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/


Re: [pygtk] MVC and TreeView

2004-06-04 Thread Jonathon McKitrick

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.

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/


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=show&file=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/


[pygtk] MVC and TreeView

2004-06-04 Thread Jonathon McKitrick

Hi all,

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?

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/


[pygtk] Subclassing GtkWidget in PyGTK

2004-06-04 Thread Johan Dahlin
Hello friends

I just added an example in CVS
(http://cvs.gnome.org/viewcvs/gnome-python/pygtk/examples/gtk/widget.py?rev=1.3&view=markup)

That demonstrates how to subclass a GtkWidget in PyGTK.

Unfortunately it requires latest CVS, since I added a bunch of stuff
required by it (modifying GdkEvent's members for instance).

-- 
Johan Dahlin <[EMAIL PROTECTED]>

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