GIMP Chat http://gimpchat.com/ |
|
Script and Plugin Menu Placement Points for script-fu and python-fu http://gimpchat.com/viewtopic.php?f=9&t=13603 |
Page 1 of 1 |
Author: | jazzon [ Thu Jan 28, 2016 2:47 am ] |
Post subject: | Script and Plugin Menu Placement Points for script-fu and python-fu |
This will bore to death someone who does not write their own scripts/plugins. In fact, it will bore You to death even if You do! It's meant as a reference, and is probably not worth reading unless You do write scripts and plugins for The GIMP!, and want to "know it all" about doing so. Dont say I didn't warn you. Some time ago a short discussion happened here about where, as in different menus, scripts could be assigned to appear. In the course of the discussion, it was noted that there appeared to be some "hidden" locations which could be assigned to, but an exhaustive list of these places was unknown. Let me say this now. Not every script or plugin should be assigned to appear in an unusual place. People expect them to be under the "Filters" menu. But occasionally, a script or plugin obviously should go elsewhere, the wonderful Path manipulation scripts by offnuts for example. So just because these locations are known, doesn't mean to scatter scripts to hell and gone through the menus!See note on Comment below. I am not up on scheme syntax, heck I can barely read it let alone write it, so these illustrations are relative to Python. In the registry section of a plugin, a menu location is assigned. It typically starts with a notation inside < and > brackets. The most used one is <Image>. These alternates are: Context Menus:
Main Program Menus: Installing into main menus is done three ways:
Hidden Locations: See the Development section which follows as well. Some, not all, of the main menu selections in The GIMP! are organized into named parts. These parts are usually, but again not always, defined by separation markers in the menu. It took some experimenting, and reading some source code, but I believe I found them all. The "table" below gives the location prefix, the menu it will install to, and a brief explanation of where in the menu it will appear. In all cases, it will appear below the normal items in that section. Entries which simply appear as expected in named sub-menus are not listed below.
Others of unusual interest: NOTE: These are for backward compatibility with scripts written for older versions of The GIMP! They should NEVER be used in writting new code!
Development For Scripts/Plugins in Hidden Areas While creating this document I had to rewrite the register portion of a Python script several times. I would then use 'Filters-> Script-fu -> Refresh Scripts' to update their placement. While this normally works, I found that in many cases it failed when the code was installed outside the Filters menu. Whether this was just sporadic behaviour, or is meant to work this way I do not know as it hasn't come up before, but I had to actually restart The GIMP! for these changes to work. Just an FYI. Notes:
For those who are truly curious, this information was gleaned through trial and error, and reading some scripts which come with The GIMP!. The trial and error part was after reading a source file at the GIT repository for The GIMP! Version: 2.8.x series Branch: Master Directory: menus File: image-menu.xml.in Direct link here. [EDIT] I added some additional information on the comments in the main document, to the "notes" at the end; and toned done the first one. The purpose of the comments was being misunderstood. [EDIT] Added a section on an issue had with developing the test code for this document. |
Author: | paynekj [ Thu Jan 28, 2016 3:56 am ] |
Post subject: | Re: Script and Plugin Menu Placement Points for script-fu and python-f |
In amongst your fervent pleas not to create menu entries that mess with users "comfortable interface" I feel you've missed one very important point. As there isn't a self-revealing mechanism, Script/Plug-in writers should make it clear exactly where their scripts will bury their menu entries and what those entries are. All too often people have installed scripts and then had to ask for help finding the menu entry. Kevin |
Author: | dinasset [ Thu Jan 28, 2016 4:48 am ] |
Post subject: | Re: Script and Plugin Menu Placement Points for script-fu and python-f |
IMO the only important point is the one by Kevin (sorry if I didn't recently follow that rule, like I did in the past). About putting every filter under Filters + submenu + submenu etc and any Script under Script-Fu + submenu + submenu etc, I disagree: are you REALLY convinced Jazzon that only ONE menu entry for hundreds (thousands?) of filters makes the search easier? I think the opposite, and I changed menu also for existing filters of other people to get a better visibility on my Gimp functionality. And I know other people here did the same. Anyhow thanks for your effort to help. I have a different simple suggestion: name the file which contains the created filter in such a way to "address" the user where he/she will be find it or at least where it's searchable under Gimp help. For some of the "ancient" filters sometimes it's very discouraging look into the Help and not find it. |
Author: | Steve [ Thu Jan 28, 2016 7:34 am ] |
Post subject: | Re: Script and Plugin Menu Placement Points for script-fu and python-f |
jazzon wrote: ...... In fact, it will bore You to death even if You do! ...... On the contrary I found it fascinating, informative and learned something, and so it’s a good day as another piece fits into place in the 100000 piece gimp jigsaw puzzle. I may never place scripts in most of those locations but its good to know how if I want to. jazzon Steve |
Author: | Rod [ Thu Jan 28, 2016 12:01 pm ] |
Post subject: | Re: Script and Plugin Menu Placement Points for script-fu and python-f |
That is the beauty of GIMP. You can make your menu look however you wish. Whatever is easiest for you to use. When i write a filter i always add the location where the filter can be found in the main topic thread. There is also a tutorial here at Gimp Chat on how to change the location of a filter for your convenience. I do however believe that the exact filter name should be added to it's description code. ie this filter does this - my-filter.scm This will make it loads easier to remove any certain filter you happen to find in the menus and really don't need that particular filter installed. Of course you can do this via the plug-in browser also but having it included in the filters description makes it faster to recognize an exact filter name. |
Author: | jazzon [ Thu Jan 28, 2016 1:07 pm ] |
Post subject: | Re: Script and Plugin Menu Placement Points for script-fu and python-f |
paynekj: Actually I was quoting complaints I have heard from many others. My personal opinion is that the author wrote it, the author knows where is best for it. Those of us who choose to install it, made a choice to install it as the author wrote it. dinasset: No I don't feel that they should all go into the menu and sub-menu of Filters. That gets way over crowded as it is. I too recode other peoples entry locations to suit my own needs, and I use GURM (A resource manager for The GIMP! to further control the onslaught. But as a script author myself, I feel it is the authors responsibility to not abuse things. If we all put our scripts DIRECTLY into the filters menu, we get just what You described, mayhem. Intelligent use of the various options and sub menus is best, both inside and outside the Filters menu. Apparently my lack of social graces spilled over again. This was simply meant to be an exposition of the extra information, not a critique of techniques. I apologize if it came off that way. Steve: Just glad to know someone might find the information useful. In truth I didn't expect anyone to actually READ the thing ... Rod: I agree about the naming conventions, and the documentation issue. Read on below To All of those who read it: Thank You! Feedback, positive or negative, is always welcome. It is only in this way I can improve my writing of these kind of things. Several have mentioned what I find to be a big problem. The fact that installation locations aren't self revealing. I stole an idea from one of the masters here ofnuts. In each of his register functions he includes a variable named "whereami" or "whereiam" or some such, which translates into the scripts exact location on Your hard drive after install. This becomes part of the "blurb" text in the registration. I go one further and added an extra line which defines the menu install point, and adds it to the blurb. Most of my plugins have internal names that start with "jaz_" or "jazzon_" (I have probably missed a few along the way), and the files themselves always start with "jazzon-" or "jazzon_", to make locating, managing, and removal easier for the end user. |
Author: | ofnuts [ Thu Jan 28, 2016 5:01 pm ] |
Post subject: | Re: Script and Plugin Menu Placement Points for script-fu and python-f |
jazzon wrote: paynekj: Actually I was quoting complaints I have heard from many others. My personal opinion is that the author wrote it, the author knows where is best for it. Those of us who choose to install it, made a choice to install it as the author wrote it. dinasset: No I don't feel that they should all go into the menu and sub-menu of Filters. That gets way over crowded as it is. I too recode other peoples entry locations to suit my own needs, and I use GURM (A resource manager for The GIMP! to further control the onslaught. But as a script author myself, I feel it is the authors responsibility to not abuse things. If we all put our scripts DIRECTLY into the filters menu, we get just what You described, mayhem. Intelligent use of the various options and sub menus is best, both inside and outside the Filters menu. Apparently my lack of social graces spilled over again. This was simply meant to be an exposition of the extra information, not a critique of techniques. I apologize if it came off that way. Steve: Just glad to know someone might find the information useful. In truth I didn't expect anyone to actually READ the thing ... Rod: I agree about the naming conventions, and the documentation issue. Read on below To All of those who read it: Thank You! Feedback, positive or negative, is always welcome. It is only in this way I can improve my writing of these kind of things. Several have mentioned what I find to be a big problem. The fact that installation locations aren't self revealing. I stole an idea from one of the masters here offnuts. In each of his register functions he includes a variable named "whereami" or "whereiam" or some such, which translates into the scripts exact location on Your hard drive after install. This becomes part of the "blurb" text in the registration. I go one further and added an extra line which defines the menu install point, and adds it to the blurb. Most of my plugins have internal names that start with "jaz_" or "jazzon_" (I have probably missed a few along the way), and the files themselves always start with "jazzon-" or "jazzon_", to make locating, managing, and removal easier for the end user. That's "ofnuts" with a single f and I'm no master. The variable is "whoami". I got the idea from a discussion here. But it's not an indication of where script/plugin shows up in the menu but a mere indication of what script/plugin file corresponds to this menu. Nice for "maintenance" but that's about it. By the way to find the menu location of a plugin, just use the very overlooked "Help>Procedure browser". |
Author: | jazzon [ Fri Jan 29, 2016 9:33 am ] |
Post subject: | Re: Script and Plugin Menu Placement Points for script-fu and python-f |
ofnuts wrote: That's "ofnuts" with a single f and I'm no master. AACK! I have defiled the master! Please forgive me Oh Mighty One! Fixed ofnuts wrote: By the way to find the menu location of a plugin, just use the very overlooked "Help>Procedure browser". I don't use it often, but You are correct it is overlooked often. In fact I rarely see it mentioned, even in these forums. |
Author: | Rod [ Sat Jan 30, 2016 9:41 am ] |
Post subject: | Re: Script and Plugin Menu Placement Points for script-fu and python-f |
jazzon wrote: ofnuts wrote: That's "ofnuts" with a single f and I'm no master. AACK! I have defiled the master! Please forgive me Oh Mighty One! Fixed ofnuts wrote: By the way to find the menu location of a plugin, just use the very overlooked "Help>Procedure browser". I don't use it often, but You are correct it is overlooked often. In fact I rarely see it mentioned, even in these forums. Yes i normally just look thru Help>Plug-in Browser to search filter location. I didn't realize procedure browser also had that capability. |
Page 1 of 1 | All times are UTC - 5 hours [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |