<?xml version="1.0"?>
<page id="Gimp.PlugIn"
      type="guide"
      style="class"
      xmlns="http://projectmallard.org/1.0/"
      xmlns:api="http://projectmallard.org/experimental/api/"
      xmlns:ui="http://projectmallard.org/1.0/ui/">
  <info>
    <link xref="index" group="class" type="guide"/>
  </info>
  <title>Gimp.PlugIn</title>
  <synopsis><code>
from gi.repository import Gimp

plug_in = Gimp.PlugIn(<link xref='Gimp.PlugIn-read-channel'>read_channel</link>=value, <link xref='Gimp.PlugIn-write-channel'>write_channel</link>=value)
  </code></synopsis>
  <p>The base class for plug-ins to derive from.</p>  <p>GimpPlugIn manages the plug-in's [class@Procedure] objects. The procedures a
plug-in implements are registered with GIMP by returning a list of their
names from either [vfunc@GimpPlugIn.query_procedures] or
[vfunc@GimpPlugIn.init_procedures].</p>  <p>Every GIMP plug-in has to be implemented as a subclass and make it known to
the libgimp infrastructure and the main GIMP application by passing its
`GType` to [func@MAIN].</p>  <p>[func@MAIN] passes the 'argc' and 'argv' of the platform's main() function,
along with the `GType`, to [func@main], which creates an instance of the
plug-in's `GimpPlugIn` subclass and calls its virtual functions, depending
on how the plug-in was called by GIMP.</p>  <p>There are 3 different ways GIMP calls a plug-in: "query", "init" and "run".</p>  <p>The plug-in is called in "query" mode once after it was installed, or when
the cached plug-in information in the config file "pluginrc" needs to be
recreated. In "query" mode, [vfunc@GimpPlugIn.query_procedures] is called
and returns a list of procedure names the plug-in implements. This is the
"normal" place to register procedures, because the existence of most
procedures doesn't depend on things that change between GIMP sessions.</p>  <p>The plug-in is called in "init" mode at each GIMP startup, and
[vfunc@PlugIn.init_procedures] is called and returns a list of procedure
names this plug-in implements. This only happens if the plug-in actually
implements [vfunc@GimpPlugIn.init_procedures]. A plug-in only needs to
implement init_procedures if the existence of its procedures can change
between GIMP sessions, for example if they depend on the presence of
external tools, or hardware like scanners, or online services, or whatever
variable circumstances.</p>  <p>In order to register the plug-in's procedures with the main GIMP application
in the plug-in's "query" and "init" modes, [class@PlugIn] calls
[vfunc@PlugIn.create_procedure] on all procedure names in the exact order of
the list returned by [vfunc@PlugIn.query_procedures] or
[vfunc@PlugIn.init_procedures] and then registers the returned
[class@Procedure].</p>  <p>The plug-in is called in "run" mode whenever one of the procedures it
implements is called by either the main GIMP application or any other
plug-in. In "run" mode, one of the procedure names returned by
[vfunc@PlugIn.query_procedures] or [vfunc@PlugIn.init_procedures] is passed
to [vfunc@PlugIn.create_procedure] which must return a [class@Procedure] for
the passed name. The procedure is then executed by calling
[method@Procedure.run].</p>  <p>In any of the three modes, [vfunc@PlugIn.quit] is called before the plug-in
process exits, so the plug-in can perform whatever cleanup necessary.</p>
  <p>Since 3.0</p>
  <synopsis>
    <title>Hierarchy</title>
    <tree>
      <item>
        <code>GObject.Object</code>
      <item>
        <code>Gimp.PlugIn</code>
      </item>
      </item>
    </tree>
  </synopsis>
  <links type="topic" ui:expanded="true"
         api:type="function" api:mime="text/python"
         groups="constructor" style="linklist">
    <title>Constructors</title>
  </links>
  <links type="topic" ui:expanded="true"
         api:type="function" api:mime="text/python"
         groups="method" style="linklist">
    <title>Methods</title>
  </links>
  <links type="topic" ui:expanded="true"
         api:type="function" api:mime="text/python"
         groups="function" style="linklist">
    <title>Static Functions</title>
  </links>
  <links type="topic" ui:expanded="true" groups="property" style="linklist">
    <title>Properties</title>
  </links>
  <links type="topic" ui:expanded="true" groups="signal" style="linklist">
    <title>Signals</title>
  </links>
  <links type="topic" ui:expanded="true" groups="vfunc" style="linklist">
    <title>Virtual functions</title>
  </links>
  <links type="topic" ui:expanded="true" groups="field" style="linklist">
    <title>Fields</title>
  </links>
  <links type="topic" ui:expanded="true" groups="#first #default #last" style="linklist">
    <title>Other</title>
  </links>
</page>
