Files
openide/python/helpersTestResources/data/docstrings/rest_gimpfu_docstring.html
T
Egor Eliseevandintellij-monorepo-bot f88aaf937f [python] Eliminate nested resource roots in helpers
Merge-request: IJ-MR-174869
Merged-by: Egor Eliseev <Egor.Eliseev@jetbrains.com>

GitOrigin-RevId: 0bf11bb8fe739c9a72615dc5f3de794235d0e589
2025-09-16 08:51:23 +00:00

52 lines
2.4 KiB
HTML

<p>Simple interface to writing GIMP plug-ins in Python.</p>
<p>Instead of worrying about all the user interaction, saving last used values
and everything, the gimpfu module can take care of it for you. It provides
a simple register() function that will register your plug-in if needed, and
cause your plug-in function to be called when needed.</p>
<p>Gimpfu will also handle showing a user interface for editing plug-in parameters
if the plug-in is called interactively, and will also save the last used
parameters, so the RUN_WITH_LAST_VALUES run_type will work correctly. It
will also make sure that the displays are flushed on completion if the plug-in
was run interactively.</p>
<p>When registering the plug-in, you do not need to worry about specifying
the run_type parameter.</p>
<dl class="rst-docutils">
<dt>A typical gimpfu plug-in would look like this:</dt>
<dd><p class="rst-first">from gimpfu import *</p>
<dl class="rst-docutils">
<dt>def plugin_func(image, drawable, args):</dt>
<dd>#do what plugins do best</dd>
<dt>register(</dt>
<dd><p class="rst-first">&quot;plugin_func&quot;,
&quot;blurb&quot;,
&quot;help message&quot;,
&quot;author&quot;,
&quot;copyright&quot;,
&quot;year&quot;,
&quot;My plug-in&quot;,
&quot;*&quot;,
[</p>
<br />
(PF_IMAGE, &quot;image&quot;, &quot;Input image&quot;),
(PF_DRAWABLE, &quot;drawable&quot;, &quot;Input drawable&quot;),
(PF_STRING, &quot;arg&quot;, &quot;The argument&quot;, &quot;default-value&quot;)<p class="rst-last">],
[],
plugin_func, menu=&quot;&lt;Image&gt;/Somewhere&quot;)</p>
</dd>
</dl>
<p class="rst-last">main()</p>
</dd>
</dl>
<p>The call to &quot;from gimpfu import *&quot; will import all the gimp constants into
the plug-in namespace, and also import the symbols gimp, pdb, register and
main. This should be just about all any plug-in needs.</p>
<p>You can use any of the PF_* constants below as parameter types, and an
appropriate user interface element will be displayed when the plug-in is
run in interactive mode. Note that the the PF_SPINNER and PF_SLIDER types
expect a fifth element in their description tuple &ndash; a 3-tuple of the form
(lower,upper,step), which defines the limits for the slider or spinner.</p>
<p>If want to localize your plug-in, add an optional domain parameter to the
register call. It can be the name of the translation domain or a tuple that
consists of the translation domain and the directory where the translations
are installed.</p>