It is currently Sat Jul 06, 2024 8:51 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Python-Fu Menupath and Documentation Question
PostPosted: Fri Nov 09, 2012 7:34 am  (#1) 
Offline
GimpChat Member

Joined: Nov 06, 2012
Posts: 11
I have been trying to teach myself how to write Gimp scripts/plug-ins using Python-Fu (and trying to learn some python along the way, as well).

I have been using the GIMP Python Documentation and a few online tutorials that I have found - Extending Gimp with Python (which is listed on Gimp Chat's GIMP Script Writing Resources thread), Use Python to write plug-ins for GIMP, and Gimp plugins with Python-fu.

According to the GIMP Python Documentation:

Quote:
The parameters to register are:

name

blurb

help

author

copyright

date

menupath

imagetypes

params

results

function

Most of these parameters are quite self explanatory. The menupath option should start with <Image>;/ for image plug-ins and <Toolbox>/ for toolbox plug-ins. The remainder of the menupath is a slash separated path to its menu item.
The above linked tutorials are consistent with the above.

However, when I was trying to solve an issue that I was having with registering a python plug-in (see my post Python Scripts not Registering in Gimp 2.8), I came across the following posts on other support sites that referenced a plug-in's menu path in the register call differently from the way it was done in the GIMP Python Documentation or the above linked tutorials:

Duplicating a layer (Python plug-in) on Gimp Forums
Attempting to Write Python Plugin and Failing Miserably on Gimp Forums
Gimp: why can't I register this? on stackoverflow

These links indicate that the menu path and the menu name should be separated, with the menu path being the last parameter listed for "register." The stackoverflow link says:

Quote:
...putting the menu path along with the script menu name is deprecated in GIMP - the correct way to do it is, after the "date" parameter, pass just the name that should show in the menu...and pass the menu path as a named parameter, at the end of the call....


Apparently, either was must work since my python plug-ins based on the materials I first linked seem to work.

My question is: Is there updated documentation on this and other aspects of python-fu? If so, where can I find that documentation? I was thinking that maybe that documentation would have other info that might be helpful.

Thanks in advance for any help. :tyspin


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: Python-Fu Menupath and Documentation Question
PostPosted: Mon Nov 12, 2012 6:31 am  (#2) 
Offline
Script Coder
User avatar

Joined: Jun 22, 2010
Posts: 1171
Location: Here and there
I can't say I know of any more recent documentation.

"Deprecated" just means the GIMP developers want you to use the new method, because they will eventually stop the old method from working, but it's OK to use it now.

I'll guess the reasoning behind separating the menu label from the menu path is down to language translation, which neatly leads into your question on the GIMP registry site: http://registry.gimp.org/node/27652

The leading underscores are there to mark strings that are suitable for language translation, see Esper's thread about translating to German: viewtopic.php?f=9&t=5648

Kevin


Top
 Post subject: Re: Python-Fu Menupath and Documentation Question
PostPosted: Mon Nov 12, 2012 4:27 pm  (#3) 
Offline
GimpChat Member

Joined: Nov 06, 2012
Posts: 11
paynekj wrote:
I'll guess the reasoning behind separating the menu label from the menu path is down to language translation, which neatly leads into your question on the GIMP registry site: http://registry.gimp.org/node/27652

The leading underscores are there to mark strings that are suitable for language translation, see Esper's thread about translating to German: viewtopic.php?f=9&t=5648

Kevin


Thanks! What significance do the parentheses surrounding "Input Directory" have:

(PF_DIRNAME, "indirectory", _("Input Directory"), os.getcwd() ),

Thanks for your patience with this noob! :-)


Top
 Post subject: Re: Python-Fu Menupath and Documentation Question
PostPosted: Mon Nov 12, 2012 4:52 pm  (#4) 
Offline
Global Moderator
User avatar

Joined: Nov 16, 2011
Posts: 5128
Location: Metro Vancouver, BC
The quotes around "Input Directory" makes it a single entity, not either Input or Directory.

_________________
Image
Gimp 2.8.18, Linux, median user
Gimp Chat Tutorials Index
Spirit Bear (Kermode)


Top
 Post subject: Re: Python-Fu Menupath and Documentation Question
PostPosted: Mon Nov 12, 2012 7:20 pm  (#5) 
Offline
GimpChat Member

Joined: Nov 06, 2012
Posts: 11
What about the parentheses (brackets) in ---> ("Input Directory") ?


Top
 Post subject: Re: Python-Fu Menupath and Documentation Question
PostPosted: Mon Nov 12, 2012 7:43 pm  (#6) 
Offline
Global Moderator
User avatar

Joined: Nov 16, 2011
Posts: 5128
Location: Metro Vancouver, BC
Think of the brackets as a box, in the box you have two items, Input and Directory. If you don't have parentheses a selector will not see them as an entity, it will see them separately.

_________________
Image
Gimp 2.8.18, Linux, median user
Gimp Chat Tutorials Index
Spirit Bear (Kermode)


Top
 Post subject: Re: Python-Fu Menupath and Documentation Question
PostPosted: Tue Nov 13, 2012 7:14 am  (#7) 
Offline
GimpChat Member

Joined: Nov 06, 2012
Posts: 11
Thank you!


Top
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Documentation for Filters ?

2

No new posts Shortcuts to 2.10 documentation re: Layer & Layer-group modes

0

No new posts Convert GIMP plugin from Python 2 to Python 3

4

No new posts Difference between "Python-Fu" and "Python" plugin

6

No new posts Stupid Question

9



* Login  



Powered by phpBB3 © phpBB Group