[Glade-users] gtkbuilder and glade - gobjects / pygtk objects



On Tue, 2009-06-23 at 09:00 +0200, Tobias Weber wrote:
On 22.06.2009, at 23:01, Mats Taraldsvik wrote:

self.previewStore = gtk.ListStore( str, object )

Try the constant gobject.TYPE_OBJECT or the string 'GObject'

No, that code works, as it uses libglade - no creation of liststore etc.
inside Glade. object maps to gobject.TYPE_OBJECT in pygtk.

self.previewView.append_column(col)

That returns the number of columns. Maybe the new XML has one too many?

However, with gtkbuilder, I get a "TypeError: value is of wrong type  
for this column"

 From where, the model ot the view? What is the line Python claims  
raised the error?

When I use gtkbuilder, and create liststore etc inside glade, I only
have this in my constructor, related to the treeview:


showsStore = self.builder.get_object("showsStore")

for Show in database :
    showsStore.append([ Show.name, Show ])

I get the error when appending to showsStore - the ListStore.

The problem is, I don't know how to handle the treeviewcolumn /
cellrenderer for the object.


###############


showsStore = self.builder.get_object("showsStore")

for Show in database :
   showsStore.append([ Show.name, Show ])


I think you may need to use a special cast to get the GObject
of a... what is it... python class ?


Yes, it is a Python class.


Not sure though, the liststore append function doesnt seem to make
sense to me either, seems like your aiming at a convenience api
that creates the GtkTreeIter, appends it, and sets all the columns
of that iter all in one go, are you sure you have the correct api
for that also ? (remember I wouldnt know, I can only guess at
what the api might be in python).


It is what I use with libglade, and it works if I create a treeview/liststore/treeviewcolumn/cellrenderer 
without the object.

The pyGTK reference for ListStore -> append() 
http://www.pygtk.org/docs/pygtk/class-gtkliststore.html#method-gtkliststore--append



Cheers,
        -Tristan

Mats

_______________________________________________
Glade-users maillist  -  Glade-users at lists.ximian.com
http://lists.ximian.com/mailman/listinfo/glade-users





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]