It is currently Sat Aug 22, 2026 7:30 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Gimp object method parameter doc
PostPosted: Tue Dec 13, 2016 5:59 pm  (#1) 
Offline
GimpChat Member

Joined: Nov 08, 2016
Posts: 45
I got my python script working using the pdb functions and now I'm converting it to using the Gimp object methods. I'm doing it both ways to learn.

At the python console "help(gimp)" will show the class and methods, but it doesn't show the parameters. For example, there is a class Image which has a resize method. I assume it takes the same parameters as the pdb function, but is there a way, python way, of viewing an object's method's parameters?

I came across this neat plugin Inspect, which adds a gui to all kinds of info one would require to write scripts. The info can be gotten other ways, but this makes it super easy, readable, searchable, and scrollable. It would be a nice addition to the Help -> Plug-In Browser, Help -> Procedure Browser (it is located Filters -> Inspect). Has anyone seen something like this, but maintained?

pdb.gimp_image_resize(img, target_width, target_height, offx, offy)
# verses
img.resize(target_width, target_height, offx, offy)


Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: Gimp object method parameter doc
PostPosted: Tue Dec 13, 2016 6:47 pm  (#2) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4812
What does this plugin show you that you don't get in the plugin browser?

_________________
Image


Top
 Post subject: Re: Gimp object method parameter doc
PostPosted: Wed Dec 14, 2016 3:26 am  (#3) 
Offline
GimpChat Member

Joined: Nov 08, 2016
Posts: 45
ofnuts wrote:
What does this plugin show you that you don't get in the plugin browser?


The main addition is the gimp-python modules, which includes the classes, methods, constants, enums, under "GIMP-Python Modules". Granted a lot of this information can be viewed on the python console, but the gui makes it so much more convenient, especially for newbies in gimp scripting.

Under "Gimp data" -> "Images" the user can inspect an image and drill down to the layer. This could help in learning and debugging (??).

"Procedure by Type" is a duplication of the data in the Procedure Browser but it is presented in a treeview, so you can clearly see "Extension", "Internal", "Plugin", "Temporary", "Unknown". The Procedure Browser just shows one list that can be searched by type. There is also a 'Procedures by image type".

The developer of the Gimp Inspector does say:

Quote:
This is an alpha version, a proof-of-concept, a work in progress. It works, and shouldn't crash. It is released for comments about the features and about the GUI.

This alpha version asks:

1) whether Gimp Python plugin programmers need an inspector, a unified way to browse internals.

2) whether pydoc documentation for Gimp plugins and Gimp-Python is worthwhile. If so, Gimp needs to be patched to allow plugins to be reimported by pydoc without aborting with the message "gimp_env_init() must only be called once." Refer to a discussion on gimp-dev mail list.

You won't see the crash from this version since this version explicitly only documents a few plugins (itself) that are safe from this crash, i.e. that guard the call to main() so that it is only called if the script is imported at the top level.

3) whether to migrate Help>Browse Plugins etc. from C to Python and Glade.

Discussion:

Uses Glade3 graphical GUI designer and pygtk (requires gtk+ 2.16).

Duplicates the existing Gimp menu items "Help>Browse Plugins" and "Help>Browse Procedures".

Documents python language plugins and modules (including GIMP-Python) using the pydoc module (distributed with python, the official way to produce documentation from python code.)

Its data driven. Other views of the data could be added, for example to view plugins by directory path.


Top
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]



* Login  



Powered by phpBB3 © phpBB Group