File: procedural-database.html

package info (click to toggle)
gimp 2.2.13-1etch4
  • links: PTS
  • area: main
  • in suites: etch
  • size: 94,832 kB
  • ctags: 47,113
  • sloc: ansic: 524,858; xml: 36,798; lisp: 9,870; sh: 9,409; makefile: 7,923; python: 2,674; perl: 2,589; yacc: 520; lex: 334
file content (361 lines) | stat: -rw-r--r-- 6,163 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
<!DOCTYPE HTML PUBLIC "-//Norman Walsh//DTD DocBook HTML 1.0//EN">
<HTML
><HEAD
><TITLE
>The Procedural Database</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet"><LINK
REL="HOME"
TITLE="Gimp Python Documentation"
HREF="pygimp.html"><LINK
REL="PREVIOUS"
TITLE="The Structure Of A Plugin"
HREF="structure-of-plugin.html"><LINK
REL="NEXT"
TITLE="Gimp Module Procedures"
HREF="gimp-module-procedures.html"></HEAD
><BODY
><DIV
CLASS="NAVHEADER"
><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>Gimp Python Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="structure-of-plugin.html"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="gimp-module-procedures.html"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="PROCEDURAL-DATABASE"
>The Procedural Database</A
></H1
><P
>The procedural database is a registry of things gimp and its
    plugins can do.  When you install a procedure for your plugin, you
    are extending the procedural database.</P
><P
>The procedural database is self documenting, in that when
    you install a procedure in it, you also add documentation for it,
    its parameters and return values.</P
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="GIMP-PYTHON-MODEL"
>The Gimp-Python Model</A
></H2
><P
>In Gimp-Python, the procedural database is represented by
      the object <TT
CLASS="PARAMETER"
><I
>gimp.pdb</I
></TT
>.  In most of my
      plugins, I make an assignment from <TT
CLASS="PARAMETER"
><I
>gimp.pdb</I
></TT
>
      to <TT
CLASS="PARAMETER"
><I
>pdb</I
></TT
> for convenience.</P
><P
>You can query the procedural database with
      <TT
CLASS="PARAMETER"
><I
>pdb</I
></TT
>'s method <TT
CLASS="FUNCTION"
><B
>query</B
></TT
>.  Its
      specification is:</P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="SCREEN"
>pdb.query(name, [blurb, [help, [author, [copyright, [date, [type]]]]]])</PRE
></TD
></TR
></TABLE
><P
>Each parameter is a regular expression that is checked
      against the corresponding field in the procedural database.  The
      method returns a list of the names of matching procedures.  If
      <TT
CLASS="FUNCTION"
><B
>query</B
></TT
> is called without any arguments, it will
      return every procedure in the database.</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="PDB-PROCEDURES"
>Procedural Database Procedures</A
></H2
><P
>Procedures can be accessed as procedures, or by treating
      <TT
CLASS="PARAMETER"
><I
>pdb</I
></TT
> as a mapping objest.  As an example,
      the probedure <TT
CLASS="FUNCTION"
><B
>gimp_edit_fill</B
></TT
> can be
      accessed as either <TT
CLASS="FUNCTION"
><B
>pdb.gimp_edit_fill</B
></TT
> or
      <TT
CLASS="FUNCTION"
><B
>pdb['gimp_edit_fill']</B
></TT
>.  The second form is
      mainly for procedures whose names are not valid Python names (eg
      in script-fu-..., the dashes are interpreted as minuses).</P
><P
>These procedure objects have a number of attribute:</P
><P
></P
><DL
><DT
>proc_name</DT
><DD
><P
>The name of the procedure.</P
></DD
><DT
>proc_blurb</DT
><DD
><P
>A short peice of information about the procedure.</P
></DD
><DT
>proc_help</DT
><DD
><P
>More detailed information about the procedure.</P
></DD
><DT
>proc_author</DT
><DD
><P
>The author of the procedure.</P
></DD
><DT
>proc_copyright</DT
><DD
><P
>The copyright holder for the procedure (usually the
            same as the author).</P
></DD
><DT
>proc_date</DT
><DD
><P
>The date when the procedure was written.</P
></DD
><DT
>proc_type</DT
><DD
><P
>The type of procedure.  This will be one of
            PROC_PLUG_IN, PROC_EXTENSION or PROC_TEMPORARY.</P
></DD
><DT
>nparams</DT
><DD
><P
>The number of parameters the procedure takes.</P
></DD
><DT
>nreturn_vals</DT
><DD
><P
>The number of return values the procedure gives.</P
></DD
><DT
>params</DT
><DD
><P
>A description of parameters of the procedure.  It
            takes the form of a tuple of 3-tuples, where each 3-tuple
            describes a parameter.  The items in the 3-tuple are a
            parameter type (one of the PARAM_* constants), a
            name for the parameter, and a description of the
            parameter.</P
></DD
><DT
>return_vals</DT
><DD
><P
>A description of the return values.  It takes the
            same form as the <TT
CLASS="LITERAL"
>params</TT
>
            attribute.</P
></DD
></DL
><P
>A procedure object may also be called.  At this point,
      Gimp-Python doesn't support keyword arguments for PDB
      procedures.  Arguments are passed to the procedure in the normal
      method.  The return depends on the number of return values:</P
><P
></P
><UL
><LI
><P
>If there are zero return values,
	  <TT
CLASS="LITERAL"
>None</TT
> is returned.</P
></LI
><LI
><P
>If there is only a single return value, it is
	  returned.</P
></LI
><LI
><P
>If there are more return values, then they are
	  returned as a tuple.</P
></LI
></UL
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="MORE-INFORMATION"
>More Information</A
></H2
><P
>For more information on invoking PDB procedures, please
      see the example plugins.  For information on individual
      procedures, please see the PDB Browser plugin (in the Xtns
      menu).  It alows you to peruse to the database
      interactively.</P
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="structure-of-plugin.html"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="pygimp.html"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="gimp-module-procedures.html"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>The Structure Of A Plugin</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Gimp Module Procedures</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>