GNOME Bugzilla – Bug 102226
libgnomeprint / libgnomeprintui bindings
Last modified: 2006-02-07 12:02:28 UTC
We are currently missing libgnomeprint and libgnomeprintui bindings. They should be placed under the namespace: gnome.print gnome.print.Font for example What about libgnomeprintui? gnome.print.ui or gnome.printui ? In bonobo is bonobo.ui, but it's only two levels. Maybe move to a seperate directory gnomeprint?
I have create gnomeprint and gnomeprintui bindings. They're not complete, but most important stuff is there and working. I'm attaching my changes; I hope they get committed... Cheers.
Created attachment 13313 [details] [review] Patch for configure.in/Makefile.am
Created attachment 13314 [details] The gnome/print directory with the libgnomeprint[ui] bindings
I forgot my "release notes" :) 1. I didn't wrap any functions involving plain structure datatypes. This includes libart_lgpl types, GnomePrintUnit and GnomeGlyphList; Eventually: o libart_lgpl should register boxed types and have python bindings; o GnomePrintUnit and GnomeGlyphList should register as boxed types or GObject, but that should be done on libgnomeprint itself. 2. The implemented namespace is gnomeprint and gnomeprint.ui. I tried using the gnome.print namespace, but the python parser doesn't allow that since 'print' is a python keyword; 3. I didn't wrap page callbacks because I have a feeling you guys will want to use the _closure version, and I honestly don't understand closures very well. Maybe someone else will complete this?...
It's been a while and I got no feedback in my last patch. Anything else I can do? Maybe I could commit this if the maintainers would give me permission? :) I am already using these bindings in my project, and they're working great...
Okay, some feedback. 1) Please submit as a diff against current cvs, use -N to include new files, not known by cvs. 2) Don't include backups or Makefile.am 3) Remove the linker hacks in __init__.py, It's the wrong way of solving the problem. Make sure libgnomeprint[ui] (both the libraries and bindings) are linked against all libraries they use symbols from instead. 4) You don't need register bonobo.defs in Makefile.am 5) You currently require a version of libgnomeprint[ui] that's not included in gnome 2.0 (it's in 2.1/2.2/CVS). The current policy has been to always use gnome 2.0 libraries and not 2.2. At some point in the future we will branch (most probably post pygtk-2.0) and start to update all the bindings against 2.2. If it's not possible to use the 2.0 libraries you're bindings will have to wait until we branch i am afraid. 5) Is it possible to create bindings for Libart_lgpl so we can get a more complete wrapping of libgnomeprint? 6) For information about how to wrap closures, look in pygtk's source code. 7) Don't remove functions/comment things in the .defs file, add ignore statements in your .override instead. This makes the .defs file general and .override specific to the python bindings. 8) pyprintui_add_defined_constants in printmodele/uimodule.c can be made better. There are functions for adding consts to a module look in modsupport.h in your python distribution. An even better solution would be to pester the libgnomeprint[ui] maintainers to include ENUMs by default. Most libraries doesn't do this, (but gtk+ and friend does) but filing a bug report upstream never hurts. 9) Maybe rename to printmodule.c/printuimodule.c so we don't confuse with the uimodule in gnome. (which probably could be rename to gnomeui too) 10) the macros in print.override/printui.override does not belong in the python bindings, should go upstream. 11) In the defs file you can specify default parameters for functions, so use it instead of | in PyArg_ParseTuple (as in O!|i:GnomePaperSelector.__init_) Apart from that the bindings looks good, complete with lots of functions wrapped. Try to resolv the issues i mentioned above and submitt an new attachment as diff (not .tar.gz) so i can view it directly in my web browser.
So much feedback in so little time! :) My comments on the issues: 1) I didn't know about cvs diff -N, otherwise I would had sent as diff instead of tgz. Sorry! 2) Don't you mean to not include Makefile.in instead of Makefile.am? 3) I think the problem is that the gnomeprint modules are not linked to libgnomeprint itself. I was trying not to touch libgnomeprint[ui], but I guess it won't be possible; 4) ok, I'll fix that. 5) libgnomeprint[ui] 2.2 has some incompatible changes to 2.0. I would prefer to use only 2.2. The roadmap points for a gnome 2.2 initial release at the end of this month. Any planned date for pygtk branching? 5*) Wrapping libart_lgpl would require registering boxed types. Since libart_lgpl doesn't link to glib, that would have to be done inside gnome-python. 7-9) ok 10) Those macros should belong in some header file, but instead were moved to the corresponding C file; I have no idea why. 11) good! Didn't know that :-) I already knew there was still plenty to do, this initial patch was only to "break the ice" and get things moving. I'll try to improve it, this weekend.
Ignoring libgnomeprint-2.0 is a good idea. There were some things in 2.0 that made language bindings difficult. Sounds like there are some other problems too (the enum problems Johan brought up).
So, if we're ignoring 2.0 and going for 2.2, should the gnomeprint bindings wait until gnome-python 2.2 branching or included together with the other 2.0 bindings? If so, should we upgrade gnome, bonobo and friends to 2.2?
I think I solved most issues reported by jdahlin. In the end, I came up with 100% complete set of libgnomeprint[ui] bindings! ;-) Problems remaining: 1) It still targets libgnomeprint[ui]-2.2, not 2.0. For what I can see, the differences from 2.0 to 2.2 are: a) s/GnomePrintMaster/GnomePrintJob/ b) Some functions from 2.0 are missing in 2.2. For example, now you cannot create a GnomePrintDialog without passing in a GnomePrintJob. I still think it is best to target 2.2 only, if possible. 2) Well, there are some const related warnings I couldn't get rid of. Well, I could get rid of them, but I would need to override some functions just because of them. 3) These bindings depend on bug #103371. Please don't forget to give me some feedback. Thanks! PS: cvs diff -N doesn't work because 'gnome/print' there is a new directory. I'll attach a patch file and a tar file. Sorry!
Created attachment 13526 [details] [review] All changes except new files in gnome/print
Created attachment 13527 [details] The gnome/print directory
Talked with Chema on IRC today. He has just released libgnomeprint 2.1.8, which includes Gustavo's patches which should make it easier to move forward.
I tried the latest patch, it looks much better, but i could not build it. I'm using the latest CVS. print.c: In function `_wrap_gnome_glyphlist_duplicate': print.c:619: `GNOME_TYPE_GLYPHLIST' undeclared (first use in this function) print.c:619: (Each undeclared identifier is reported only once print.c:619: for each function it appears in.) print.c: In function `_wrap_gnome_print_config_get': print.c:890: warning: implicit declaration of function `GNOME_PRINT_CONFIG' print.c:890: warning: passing arg 1 of `gnome_print_config_get' makes pointer from integer without a cast Btw, you forgot to AC_SUBST the variables in configure.in and do not include -I$(topsrc_dir)/libart_lgpl in the Makefiles
Regarding AC_SUBST, I didn't include it because I don't understand why all those AC_SUBST's are necessary, since PKG_CHECK_MODULES already does AC_SUBST. About -I$(topsrc_dir)/libart_lgpl, sorry, I had an initial idea of making a 'art' python module, then changed my mind and forgot to remove that include. You are not able to compile because of #103371. You need to update your copy if libgnomeprint and install it.
So, i managed to compile with latest libgnomeprint[ui], but i get this error when i'm trying to import, i don't know if it's your/pygobject or libgnomeprints fault. >>> import gnomeprint (process:6364): GLib-GObject-CRITICAL **: file gboxed.c: line 310 (g_boxed_type_register_static): assertion `boxed_copy != NULL' failed ** (process:6364): CRITICAL **: file pygboxed.c: line 135 (pyg_register_boxed): assertion `boxed_type != 0' failed Btw, renamed gnome/print to gnomeprint and checked in everything into CVS.
Just reopenned the dependent gnomeprint bug. The registration for the GnomePrintUnit type passes NULL for the copy/free functions, which sounds like the cause of the above.
Just for the record, my original patch that I attached to #103371 used empty functions for GBoxedCopy/GBoxedFree; Chema thought of simplifying the code a bit by passing NULL instead. I didn't know that NULL didn't work, so I said nothing. I *do* test my patches (minimally) before sending them to bugzilla, rest assured.
Created attachment 13588 [details] [review] Final touches for the gnomeprint module
Please consider committing this last patch. After that, I think we can finally close this bug. :-)
So, checked in. To compile without warning the bindings depends on bug 103589 Many thanks Gustavo, you rock! -> marking FIXED
mass reassign...