[gimp-help-2] Add docs for Python-Fu submenu



commit a228e34468fa8f20467eef5d0450743d6c2fe72b
Author: Ulf-D. Ehlert <ulfehlert svn gnome org>
Date:   Mon Oct 26 22:01:52 2009 +0100

    Add docs for Python-Fu submenu
    
    Also, change style for <programlisting> within <tip>.

 .../filters/python-fu-console-browse-applied.png   |  Bin 0 -> 5748 bytes
 images/C/menus/filters/python-fu-console.png       |  Bin 0 -> 12243 bytes
 images/C/menus/filters/python-fu.png               |  Bin 0 -> 5960 bytes
 src/appendix/bibliography.xml                      |    7 +
 src/menus/filters.xml                              |    3 +-
 src/menus/filters/python-fu.xml                    |  187 ++++++++++++++++++++
 src/menus/filters/script-fu.xml                    |    8 +-
 stylesheets/drafthtml.xsl                          |    2 +-
 stylesheets/gimp-help-screen.css                   |   11 ++
 stylesheets/gimp22.css                             |    9 +
 10 files changed, 223 insertions(+), 4 deletions(-)
---
diff --git a/images/C/menus/filters/python-fu-console-browse-applied.png b/images/C/menus/filters/python-fu-console-browse-applied.png
new file mode 100644
index 0000000..d6aa42f
Binary files /dev/null and b/images/C/menus/filters/python-fu-console-browse-applied.png differ
diff --git a/images/C/menus/filters/python-fu-console.png b/images/C/menus/filters/python-fu-console.png
new file mode 100644
index 0000000..c52139f
Binary files /dev/null and b/images/C/menus/filters/python-fu-console.png differ
diff --git a/images/C/menus/filters/python-fu.png b/images/C/menus/filters/python-fu.png
new file mode 100644
index 0000000..54997e6
Binary files /dev/null and b/images/C/menus/filters/python-fu.png differ
diff --git a/src/appendix/bibliography.xml b/src/appendix/bibliography.xml
index 6dd8c7e..29502da 100644
--- a/src/appendix/bibliography.xml
+++ b/src/appendix/bibliography.xml
@@ -587,6 +587,13 @@
         </ulink>
       </releaseinfo>
     </biblioentry>
+    <biblioentry id="bibliography-online-python">
+      <abbrev>PYTHON</abbrev>
+      <title>Python Programming Language</title>
+      <releaseinfo>
+        <ulink url="http://www.python.org";>http://www.python.org</ulink>
+      </releaseinfo>
+    </biblioentry>
     <biblioentry id="bibliography-online-scribus">
       <abbrev>SCRIBUS</abbrev>
       <title>Scribus :: Open Source Desktop Publishing</title>
diff --git a/src/menus/filters.xml b/src/menus/filters.xml
index 07c7aaa..919b581 100644
--- a/src/menus/filters.xml
+++ b/src/menus/filters.xml
@@ -2,6 +2,7 @@
 <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
                        "http://www.docbook.org/xml/4.3/docbookx.dtd";>
 <!--section history:
+  2009-10-?? ude: added python-fu.xml
   2009-08-24 ude: moved/renamed xtns-script-fu.xml to filters/script-fu.xml
   2009-02-02 j.h: moved xtns-script-fu.xml from the deprecated Toolbox/Xtns
   2006-01-21 en;fr reviewed by j.h
@@ -20,6 +21,6 @@
   <xi:include href="filters/reshow.xml"/>
   <xi:include href="filters/reset-all.xml"/>
   <!-- ... -->
-  <!--TODO xi:include href="filters/python-fu.xml"/-->
+  <xi:include href="filters/python-fu.xml"/>
   <xi:include href="filters/script-fu.xml"/>
 </sect1>
diff --git a/src/menus/filters/python-fu.xml b/src/menus/filters/python-fu.xml
new file mode 100644
index 0000000..123dc20
--- /dev/null
+++ b/src/menus/filters/python-fu.xml
@@ -0,0 +1,187 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE sect2 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
+                       "http://www.docbook.org/xml/4.3/docbookx.dtd";>
+<!-- section history:
+  2009-10-26 ude: created
+-->
+<sect2 id="gimp-filters-python-fu" xmlns:xi="http://www.w3.org/2001/XInclude";>
+  <title>The <quote>Python-Fu</quote> Submenu</title>
+
+  <indexterm>
+    <primary>Python-Fu</primary>
+    <secondary>Sub-menu</secondary>
+  </indexterm>
+
+  <figure>
+    <title>The <quote>Python-Fu</quote> submenu</title>
+    <mediaobject>
+      <imageobject>
+        <imagedata fileref="images/menus/filters/python-fu.png" format="PNG"/>
+      </imageobject>
+    </mediaobject>
+  </figure>
+  <para>
+    By default this submenu just contains the Python-Fu console.
+  </para>
+  <!-- cf. plug-ins/pygimp/doc/pygimp.html -->
+  <para>
+    <!--TODO link linkend="gimp-concepts-python-fu"-->Python-Fu<!--/link-->
+    is a set of <link linkend="bibliography-online-python">Python</link>
+    modules that act as a wrapper to <emphasis>libgimp</emphasis> allowing
+    the writing of plug-ins for <acronym>GIMP</acronym>.
+  </para>
+
+  <sect3>
+    <title>Activating the submenu</title>
+    <itemizedlist>
+      <listitem>
+        <para>
+          You can access this command from the image menu through
+          <menuchoice>
+            <guimenu>Filters</guimenu>
+            <guimenuitem>Python-Fu</guimenuitem>
+          </menuchoice>
+        </para>
+      </listitem>
+    </itemizedlist>
+  </sect3>
+
+  <sect3 id="python-fu-console">
+    <title>The Python-Fu Console</title>
+    <para>
+      The Python-Fu console is a dialog window running a <quote>Python
+      shell</quote> (a Python interpreter in interactive mode). This console
+      is set up to make use of the internal <acronym>GIMP</acronym> library
+      routines of <emphasis>libgimp</emphasis>.
+    </para>
+    <para>
+      You can use the Python-Fu console to interactively test Python commands.
+    </para>
+    <para>
+      The console consists of a large scrollable main window for input and
+      output, where you can type Python commands. When you type in a Python
+      command and then press the <keycap>Enter</keycap> key, the command is
+      executed by the Python interpreter. The command's output as well as its
+      return value (and its error message, if any) will be displayed in the
+      main window.
+    </para>
+    <figure>
+      <title>The Python-Fu Console</title>
+      <mediaobject>
+        <imageobject>
+          <imagedata format="PNG"
+            fileref="images/menus/filters/python-fu-console.png"/>
+        </imageobject>
+      </mediaobject>
+    </figure>
+    <variablelist>
+      <title>The Python-Fu Console Buttons</title>
+      <varlistentry>
+        <term>Save</term>
+        <listitem>
+          <para>
+            This command lets you save the content of the main window, that is
+            the Python-Fu console input and output (including the
+            <quote><code>&gt;&gt;&gt;</code></quote> prompt).
+          </para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term>Clear</term>
+        <listitem>
+          <para>
+            Wenn you click on this button, the content of the main window will
+            be removed. Note that you can't get back the removed content using
+            the <guilabel>Save</guilabel> command.
+          </para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term>Browse</term>
+        <listitem>
+        <!--
+          <para>
+            When clicked, the
+            <link linkend="plug-in-dbbrowser">procedure browser</link> pops
+            up, with an additional button at the bottom of the window:
+          </para>
+          <mediaobject>
+            <imageobject>
+              <imagedata format="PNG"
+                fileref="images/menus/script-fu-console-browse.png"/>
+            </imageobject>
+            <caption>
+              <para>
+                The additional button of the Procedure Browser
+              </para>
+            </caption>
+          </mediaobject>
+        -->
+        <!-- TODO check: With or without image? -->
+          <para>
+            When clicked, the
+            <link linkend="plug-in-dbbrowser">procedure browser</link> pops
+            up, with an additional button <guibutton>Apply</guibutton> at the
+            bottom of the window.
+          </para>
+          <para>
+            When you press this <guibutton>Apply</guibutton> button in the
+            procedure browser, a call to the selected procedure will be pasted
+            into the console window as a Python command:
+          </para>
+          <mediaobject>
+            <imageobject>
+              <imagedata format="PNG"
+                fileref="images/menus/filters/python-fu-console-browse-applied.png"/>
+            </imageobject>
+            <caption>
+              <para>Applied <acronym>PDB</acronym> procedure</para>
+            </caption>
+          </mediaobject>
+          <para>
+            Now you just have to replace the parameter names (here:
+            <quote>width</quote>, <quote>height</quote>, and
+            <quote>type</quote>) with actual values, e.g.
+          </para>
+          <!-- Don't wrap the following line (without testing)! -->
+          <programlisting>image = pdb.gimp_image_new(400, 300, RGB)</programlisting>
+          <para>
+            Then press <keycap>Enter</keycap> to execute the command.
+          </para>
+          <para>
+            You can (and should!) use the constants you find in the decription
+            of the procedure's parameters, for example
+            <quote>RGB-IMAGE</quote> or <quote>OVERLAY-MODE</quote>. But note
+            that you have to replace hyphens (<quote>-</quote>) with
+            underscores (<quote>_</quote>): <code>RGB_IMAGE</code>,
+            <code>OVERLAY_MODE</code>.
+          </para>
+          <tip>
+            <!-- cf. plug-ins/pygimp/doc/pygimp.html -->
+            <para>
+              Python-Fu is not limited to just calling procedures from the
+              <link linkend="glossary-pdb"><acronym>PDB</acronym></link>
+              (<acronym>GIMP</acronym> procedural database). To create a new
+              image object like in the example above, you can also type
+            </para>
+            <programlisting>
+              image = gimp.Image(width, height, type)
+            </programlisting>
+            <para>
+              (with actual values for <quote>width</quote>,
+              <quote>height</quote>, and <quote>type</quote>).
+            </para>
+          </tip>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term>Close</term>
+        <listitem>
+          <para>
+            Pressing this button closes the console.
+          </para>
+        </listitem>
+      </varlistentry>
+    </variablelist>
+  </sect3>
+</sect2>
diff --git a/src/menus/filters/script-fu.xml b/src/menus/filters/script-fu.xml
index fc94c7a..ee47658 100644
--- a/src/menus/filters/script-fu.xml
+++ b/src/menus/filters/script-fu.xml
@@ -114,7 +114,7 @@
           </mediaobject>
           <para>
             When you press this <guibutton>Apply</guibutton> button in the
-            procudure browser, the selected procedure will be pasted into the
+            procedure browser, the selected procedure will be pasted into the
             text box:
           </para>
           <mediaobject>
@@ -123,7 +123,11 @@
             fileref="images/menus/script-fu-console-browse-applied.png" />
             </imageobject>
             <caption>
-              <para>Applied Script-Fu procedure</para>
+              <para>
+                Applied
+                <link linkend="glossary-pdb"><acronym>PDB</acronym></link>
+                procedure
+               </para>
             </caption>
           </mediaobject>
           <para>
diff --git a/stylesheets/drafthtml.xsl b/stylesheets/drafthtml.xsl
index 25247a4..807b94a 100644
--- a/stylesheets/drafthtml.xsl
+++ b/stylesheets/drafthtml.xsl
@@ -14,7 +14,7 @@
   <xsl:param name="callout.graphics.path">images/callouts/</xsl:param>
   <xsl:param name="generate.index">0</xsl:param>
   <xsl:param name="html.stylesheet">
-    gimp-help-plain.css gimp-help-screen.css gimp-help-draft.css
+    gimp-help-plain.css gimp-help-screen.css gimp-help-custom.css gimp-help-draft.css
   </xsl:param>
   <xsl:param name="make.valid.html" select="1" />
   <xsl:param name="id.warnings" select="0" />
diff --git a/stylesheets/gimp-help-screen.css b/stylesheets/gimp-help-screen.css
index 9cf9184..f2da3eb 100644
--- a/stylesheets/gimp-help-screen.css
+++ b/stylesheets/gimp-help-screen.css
@@ -301,6 +301,12 @@ span.application {
   margin: 1.33em 0;
   padding: 1.33em;
 }
+.tip .programlisting {
+  white-space: pre-line; /* preserve newlines, but not spaces*/
+  margin: 1em 0;
+  padding: 0 0 0 4em;
+}
+
 .literallayout {
   padding-left: 4em;
 }
@@ -589,6 +595,11 @@ pre.programlisting {
   background-color: #eeeeec;
   border-color: #eeeeec;
 }
+.tip pre.programlisting {
+  background-color: inherit;
+  border: 0;
+}
+
 .guimenu,.guisubmenu,.guimenuitem,.guilabel,.guibutton {
   color: #0e2426;
   border-color: #eeeeec;
diff --git a/stylesheets/gimp22.css b/stylesheets/gimp22.css
index c622e59..486abae 100644
--- a/stylesheets/gimp22.css
+++ b/stylesheets/gimp22.css
@@ -287,6 +287,11 @@
 		margin: 1.33em 0;
 		padding: 1.33em;
 	}
+	.tip .programlisting {
+		white-space: pre-line; /* preserve newlines, but not spaces*/
+		margin: 1em 0;
+		padding: 0 0 0 4em;
+	}
 	.literallayout {
 		padding-left: 4em;
 	}
@@ -544,6 +549,10 @@
 		background-color: #fff;
 		border-color: #aaa;
 	}
+	.tip pre.programlisting {
+		background-color: inherit;
+		border: 0;
+	}
 	.guimenu,.guisubmenu,.guimenuitem,.guilabel,.guibutton {
 		background-color: #eee;
 	}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]