mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
Merge-request: IJ-MR-174869 Merged-by: Egor Eliseev <Egor.Eliseev@jetbrains.com> GitOrigin-RevId: 0bf11bb8fe739c9a72615dc5f3de794235d0e589
52 lines
2.4 KiB
HTML
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">"plugin_func",
|
|
"blurb",
|
|
"help message",
|
|
"author",
|
|
"copyright",
|
|
"year",
|
|
"My plug-in",
|
|
"*",
|
|
[</p>
|
|
<br />
|
|
(PF_IMAGE, "image", "Input image"),
|
|
(PF_DRAWABLE, "drawable", "Input drawable"),
|
|
(PF_STRING, "arg", "The argument", "default-value")<p class="rst-last">],
|
|
[],
|
|
plugin_func, menu="<Image>/Somewhere")</p>
|
|
</dd>
|
|
</dl>
|
|
<p class="rst-last">main()</p>
|
|
</dd>
|
|
</dl>
|
|
<p>The call to "from gimpfu import *" 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 – 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>
|