1
/* -*- Mode: C; c-basic-offset: 4 -*-
2
Gimp-Python - allows the writing of Gimp plugins in Python.
3
Copyright (C) 2005 Manish Singh <yosh@gimp.org>
5
This program is free software; you can redistribute it and/or modify
6
it under the terms of the GNU General Public License as published by
7
the Free Software Foundation; either version 2 of the License, or
8
(at your option) any later version.
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
GNU General Public License for more details.
15
You should have received a copy of the GNU General Public License
16
along with this program; if not, write to the Free Software
17
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
27
#include <glib-object.h>
29
#include <pygobject.h>
31
#include "pygimp-api.h"
32
#include "pygimp-util.h"
36
add_misc_enums(PyObject *m)
38
PyModule_AddIntConstant(m, "PARASITE_PERSISTENT",
39
GIMP_PARASITE_PERSISTENT);
40
PyModule_AddIntConstant(m, "PARASITE_UNDOABLE",
41
GIMP_PARASITE_UNDOABLE);
42
PyModule_AddIntConstant(m, "PARASITE_ATTACH_PARENT",
43
GIMP_PARASITE_ATTACH_PARENT);
44
PyModule_AddIntConstant(m, "PARASITE_PARENT_PERSISTENT",
45
GIMP_PARASITE_PARENT_PERSISTENT);
46
PyModule_AddIntConstant(m, "PARASITE_PARENT_UNDOABLE",
47
GIMP_PARASITE_PARENT_UNDOABLE);
48
PyModule_AddIntConstant(m, "PARASITE_ATTACH_GRANDPARENT",
49
GIMP_PARASITE_ATTACH_GRANDPARENT);
50
PyModule_AddIntConstant(m, "PARASITE_GRANDPARENT_PERSISTENT",
51
GIMP_PARASITE_GRANDPARENT_PERSISTENT);
52
PyModule_AddIntConstant(m, "PARASITE_GRANDPARENT_UNDOABLE",
53
GIMP_PARASITE_GRANDPARENT_UNDOABLE);
55
PyModule_AddIntConstant(m, "UNIT_PIXEL",
57
PyModule_AddIntConstant(m, "UNIT_INCH",
59
PyModule_AddIntConstant(m, "UNIT_MM",
61
PyModule_AddIntConstant(m, "UNIT_POINT",
63
PyModule_AddIntConstant(m, "UNIT_PICA",
66
PyModule_AddIntConstant(m, "MIN_IMAGE_SIZE",
68
PyModule_AddIntConstant(m, "MAX_IMAGE_SIZE",
71
PyModule_AddObject(m, "MIN_RESOLUTION",
72
PyFloat_FromDouble(GIMP_MIN_RESOLUTION));
73
PyModule_AddObject(m, "MAX_RESOLUTION",
74
PyFloat_FromDouble(GIMP_MAX_RESOLUTION));
76
PyModule_AddObject(m, "MAX_MEMSIZE",
77
PyLong_FromUnsignedLongLong(GIMP_MAX_MEMSIZE));
81
add_registered_enums(PyObject *m)
86
names = gimp_enums_get_type_names(&num_names);
88
pyg_enum_add_constants(m, GIMP_TYPE_CHECK_SIZE, "GIMP_");
89
pyg_enum_add_constants(m, GIMP_TYPE_CHECK_TYPE, "GIMP_");
91
for (i = 0; i < num_names; i++)
92
pyg_enum_add_constants(m, g_type_from_name(names[i]), "GIMP_");
96
/* Initialization function for the module (*must* be called initgimpenums) */
98
static char gimpenums_doc[] =
99
"This module provides interfaces to allow you to write gimp plugins"
107
pygimp_init_pygobject();
113
/* Create the module and add the functions */
114
m = Py_InitModule3("_gimpenums", NULL, gimpenums_doc);
117
add_registered_enums(m);
119
/* Check for errors */
120
if (PyErr_Occurred())
121
Py_FatalError("can't initialize module _gimpenums");