mirror of https://github.com/GNOME/gimp.git
plug-ins/pygimp/Makefile.am New file, provides only an initialization
2006-02-28 Manish Singh <yosh@gimp.org> * plug-ins/pygimp/Makefile.am * plug-ins/pygimp/pygimp-util.h: New file, provides only an initialization wrapper for now (pygimp_init_pygobject). * plug-ins/pygimp/gimpcolormodule.c * plug-ins/pygimp/gimpenumsmodule.c: Use pygimp_init_pygobject here. Closes bug #332622.
This commit is contained in:
parent
f96ee3ff26
commit
901654a6c7
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
2006-02-28 Manish Singh <yosh@gimp.org>
|
||||
|
||||
* plug-ins/pygimp/Makefile.am
|
||||
* plug-ins/pygimp/pygimp-util.h: New file, provides only an
|
||||
initialization wrapper for now (pygimp_init_pygobject).
|
||||
|
||||
* plug-ins/pygimp/gimpcolormodule.c
|
||||
* plug-ins/pygimp/gimpenumsmodule.c: Use pygimp_init_pygobject here.
|
||||
Closes bug #332622.
|
||||
|
||||
2006-02-28 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/core/gimpbrush.c
|
||||
|
|
|
@ -36,7 +36,8 @@ gimp_la_SOURCES = \
|
|||
pygimp-pdb.c \
|
||||
pygimp-tile.c \
|
||||
pygimp.h \
|
||||
pygimp-api.h
|
||||
pygimp-api.h \
|
||||
pygimp-util.h
|
||||
|
||||
gimp_la_LDFLAGS = -module -avoid-version $(no_undefined) \
|
||||
-export-symbols-regex initgimp
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
|
||||
#include "pygimpcolor.h"
|
||||
|
||||
#include "pygimp-util.h"
|
||||
|
||||
|
||||
#if PY_VERSION_HEX >= 0x2030000
|
||||
#define ARG_UINTARRAY_FORMAT "(IIII)"
|
||||
|
@ -361,7 +363,7 @@ initgimpcolor(void)
|
|||
{
|
||||
PyObject *m, *d;
|
||||
|
||||
init_pygobject();
|
||||
pygimp_init_pygobject();
|
||||
|
||||
/* Create the module and add the functions */
|
||||
m = Py_InitModule3("gimpcolor", gimpcolor_methods, gimpcolor_doc);
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <pygobject.h>
|
||||
|
||||
#include "pygimp-api.h"
|
||||
#include "pygimp-util.h"
|
||||
|
||||
|
||||
static void
|
||||
|
@ -103,7 +104,8 @@ init_gimpenums(void)
|
|||
{
|
||||
PyObject *m;
|
||||
|
||||
init_pygobject();
|
||||
pygimp_init_pygobject();
|
||||
|
||||
init_pygimp();
|
||||
|
||||
gimp_enums_init();
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
/* -*- Mode: C; c-basic-offset: 4 -*-
|
||||
Gimp-Python - allows the writing of Gimp plugins in Python.
|
||||
Copyright (C) 2006 Manish Singh <yosh@gimp.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef _PYGIMP_UTIL_H_
|
||||
#define _PYGIMP_UTIL_H_
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
#include <pygobject.h>
|
||||
|
||||
#define pygimp_init_pygobject() G_STMT_START { \
|
||||
PyObject *pygtkmodule = PyImport_ImportModule("pygtk"); \
|
||||
if (pygtkmodule != NULL) { \
|
||||
PyObject *mdict, *require_obj, *require_ver, *require_res; \
|
||||
mdict = PyModule_GetDict(pygtkmodule); \
|
||||
require_obj = PyDict_GetItemString(mdict, "require"); \
|
||||
require_ver = PyString_FromString("2.0"); \
|
||||
require_res = PyObject_CallFunctionObjArgs(require_obj, require_ver, \
|
||||
NULL); \
|
||||
Py_XDECREF(require_ver); \
|
||||
if (require_res) { \
|
||||
Py_DECREF(require_res); \
|
||||
if (PyErr_Occurred()) \
|
||||
return; \
|
||||
} else { \
|
||||
return; \
|
||||
} \
|
||||
} else { \
|
||||
PyErr_SetString(PyExc_ImportError, \
|
||||
"could not import pygtk"); \
|
||||
return; \
|
||||
} \
|
||||
init_pygobject(); \
|
||||
} G_STMT_END
|
||||
|
||||
#endif /* _PYGIMP_UTIL_H_ */
|
Loading…
Reference in New Issue