GNOME Bugzilla – Bug 123037
gtk.ListStore.set_column_types is missing
Last modified: 2005-08-22 12:44:38 UTC
And we need to wrap this because sometimes we don't want to set the column types in the __init__ method. Example: class MyList(gtk.ListStore): __gproperties__{ # my custom properties } def __init__(self): self.__gobject_init__() # I can't call gtk.ListStore.__init__ here or I will lose my # properties
For the example you gave, my preferred solution would be to make gtk.ListStore.__init__() work for a registered subclass (see bug 129843). Do you have a use case for set_column_types() appart from the example? From what Johnathan and Kristian have told me, this function was added for use by subclasses or code that constructs list stores with g_object_new(). Changing the column types/number of columns after construction is not supported.
Hello folks, Is there a reason for not calling ListStore.__init__(self) *before* calling self.__gobject_init__()?
Yes, and the reason is bug 129843.
Yes, if you do that you'll end up calling the constructor twice. self.__gobject_init__() is basically a hack/workaround. For the proper solution see bug 129843 as james pointed out.
Though I have a solution for bug 129843, it really doesn't help in this case because there are no construct properties in GtkListStore. So... http://cvs.gnome.org/viewcvs/gnome-python/pygtk/gtk/gtktreeview.override?r1=1.32&r2=1.33&diff_format=u