Re: [Gimp-developer] Improving pygimp documentation



The problem with that is that help() would not display the__doc__ for
the instance of PDBFunction, but will instead generate a generic
overview of the class itself. As far as I can tell this is because
help() doesn't recognize PDBFunction instances as functions (or
routines as they're called in inspect). I had actually tried your
approach initially and it did not work coming from the C side or from
the Python side. This is why I created a custom help(). To get help()
to display the __doc__ of an object it has to be a C builtin or a
python function.

This brings me to a messier idea that I had to get around this. One
way to get around this issue of __doc__ not being display is to
actually create a regular python function for each procedure. Instead
of using gimp.PDB you would have to wrap it in a class that will use
its methods but hook into __getattr__. Inside of __getattr__ it would
create a function that would then be able to have a __doc__ that would
be displayed by help.

https://gist.github.com/smunkel/5103533


On Mon, Mar 4, 2013 at 6:46 AM, Joao S. O. Bueno <gwidion mpc com br> wrote:
Your approach could lead to a a patch to dynamically provide the __doc__
attributes of PDB items - taht would be ok. For the builtin items,
such as Layer, Image and such, as the code is today,
the documentation would have to be hard-coded in the C files, however.

  js
 -><-


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