GNOME Bugzilla – Bug 113271
Cannot use custom glade widgets
Last modified: 2004-12-22 21:47:04 UTC
I cannot use custom glade widgets in pygtk/libglade code. I guess a call to glade_set_custom_handler() with a handler needs to be created -- is there a technical reason why this hasn't been done or should it be quite trivial? /me is willing to learn more of the python/c bridging API to implement this.
Attaching a first draft at a patch. It was constrcuted via a genetic algorithm, copying random pieces of c/python code until it worked... gtk.glade.set_custom_widget_callbacks(locals()) gtk.glade.XML("foo.glade") works as expected.
Created attachment 16725 [details] [review] First draft
From attachment: tuple = PyMapping_GetItemString(...); PyErr_Clear(); //? We need to call PyErr_Clear() afterwards, since if the return value is NULL an exception was raised. + args = PyList_New(0); + ret = PyObject_Call(tuple, args, NULL); There are convinience functions in python to do that, use PyObject_CallFunction. Looks good apart from that. *awaiting next patch*
Created attachment 17136 [details] [review] Updated patch
Checking in ChangeLog; /cvs/gnome/gnome-python/pygtk/ChangeLog,v <-- ChangeLog new revision: 1.624; previous revision: 1.623 done Checking in gtk/libglade.defs; /cvs/gnome/gnome-python/pygtk/gtk/libglade.defs,v <-- libglade.defs new revision: 1.10; previous revision: 1.9 done Checking in gtk/libglade.override; /cvs/gnome/gnome-python/pygtk/gtk/libglade.override,v <-- libglade.override new revision: 1.21; previous revision: 1.20 done
I applied this patch to 1.99.16 and it's working great, so far.