After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 113271 - Cannot use custom glade widgets
Cannot use custom glade widgets
Status: RESOLVED FIXED
Product: pygtk
Classification: Bindings
Component: general
1.99.x/2.0.x
Other Linux
: Normal normal
: ---
Assigned To: Python bindings maintainers
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2003-05-19 10:03 UTC by Ross Burton
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
First draft (2.18 KB, patch)
2003-05-22 09:36 UTC, Ross Burton
none Details | Review
Updated patch (2.14 KB, patch)
2003-06-04 16:28 UTC, Ross Burton
none Details | Review

Description Ross Burton 2003-05-19 10:03:30 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.
Comment 1 Ross Burton 2003-05-22 09:35:53 UTC
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.
Comment 2 Ross Burton 2003-05-22 09:36:13 UTC
Created attachment 16725 [details] [review]
First draft
Comment 3 Johan (not receiving bugmail) Dahlin 2003-05-31 00:25:00 UTC
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*
Comment 4 Ross Burton 2003-06-04 16:28:13 UTC
Created attachment 17136 [details] [review]
Updated patch
Comment 5 Johan (not receiving bugmail) Dahlin 2003-06-06 00:51:18 UTC
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
Comment 6 Jon Willeke 2003-07-30 17:11:26 UTC
I applied this patch to 1.99.16 and it's working great, so far.