On Dom, 2003-03-09 at 06:51, Jason Monroe Martin wrote:
> Hello, I have a few questions to ask someone on the list about python
> and pygtk2. I started out with gtk1.2 and I now am porting my code to 
> gtk2.2. I am using pygtk 1.99.15 on redhat 7.3 (garnome in my home dir), 
> suse 8.1(supplementary gnome2 updates) and using Cedric's win32 port. I 
> have a database with 25 tables, two of which produce a TreeView with 1 
> million plus cells ( Yes, I know it is overkill but I am testing 
> everything before I roll it out). My basic design is over 8000 lines of 
> code so far and goes like this.The user logs on and my main window pops 
> up with a combobox at the top where the user selects a table and it 
> opens a treeview in the center showing all the rows in that table.
> At the bottom you have all the normal buttons to refresh, print, delete 
> or open a record when the user selects a row.
> 
> My first question is :
> 
> When the user selects a table from the combobox I pass the data and 
> column headers to a function which destroys the treeview and creates a 
> new one along with a new ListStore model out of the data.
> Does the old model actually go away when you destroy a treeview? If not 
> how do you remove a model?

  You don't have to do anything. Python's and Gtk's memory management
(reference counting) work together so that you don't have to worry about
it.  Just don't keep any reference to the old model in python. Example,
if 'model' holds the GtkListStore reference, just changing its value to
the new model is sufficient.

> 
> My second question is :
> 
> My treeviews seem slow even on small tables compared to the clist in 
> pygtk6.x. and I get this error from some of the data (WARNING **: 
> Invalid UTF8 string passed to pango_layout_set_text()). Is this what is
> slowing me down. I am new to locales and unicode and have not figured 
> out how to get rid of this error yet. Are there any settings that I can
> use to speed them up.

  Well, you have to pass to gtk UTF-8 encoded strings only.  If you are
using non-ASCII sctrings (accented characters, for example) I suggest
you use unicode string and convert to utf-8, like this:
        s = u'Th�oden'.encode('utf-8')

> 
> My Third question is :
> Has anyone used the combobox much in 1.99.15. It seems to me it is 
> calling the changed signal twice. I did not have time to create a small 
> sample but I did look at my code pretty good.

  I don't know about this.  I hate combobox.  If you can avoid it, don't
use it.  For example, if you have a fixed list of options, use a
gtk.OptionMenu instead.

> 
> Thanks in advance to anyone who answers and I hope more people see the 
> value of using 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/
-- 
Gustavo Jo�o Alves Marques Carneiro
<[EMAIL PROTECTED]> <[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/

Reply via email to