Bug 761140: importing gimpui module causes plugin query failure

Remove gimp_ui_init call from gimpui module initialization.

Add gimp_ui_init method to gimpui module and call it from
gimpplugin _run method before running the user code.
This commit is contained in:
Massimo Valentini
2016-07-27 19:07:48 +02:00
parent 3574814897
commit f51acf3bfb
5 changed files with 26 additions and 2 deletions

View File

@ -372,6 +372,7 @@ def _interact(proc_name, start_params):
import gimpui
import gtk
# import pango
gimpui.gimp_ui_init ()
defaults = _get_defaults(proc_name)
defaults = defaults[len(start_params):]

View File

@ -54,6 +54,10 @@ class plugin:
pass
def _run(self, name, params):
import sys
if "gimpui" in sys.modules.keys():
sys.modules["gimpui"].gimp_ui_init ()
if hasattr(self, name):
return apply(getattr(self, name), params)
else:

View File

@ -1443,6 +1443,11 @@
)
)
(define-function gimp_ui_init
(c-name "gimp_ui_init")
(return-type "none")
)
(define-function gimp_enum_combo_box_new_with_model
(c-name "gimp_enum_combo_box_new_with_model")
(return-type "GtkWidget*")

View File

@ -2061,3 +2061,15 @@ _wrap_gimp_zoom_preview_get_source(PyGObject *self)
return Py_BuildValue("(Niii)", pyimage, width, height, bpp);
}
%%
override gimp_ui_init noargs
static PyObject *
_wrap_gimp_ui_init(PyObject *self)
{
extern const char *prog_name;
gimp_ui_init (prog_name, FALSE);
Py_INCREF(Py_None);
return Py_None;
}

View File

@ -57,12 +57,15 @@ init_pycairo(void)
return TRUE;
}
extern const char *prog_name;
const char *prog_name = "pygimp";
PyMODINIT_FUNC
init_gimpui(void)
{
PyObject *m, *d;
PyObject *av;
char *prog_name = "pygimp";
av = PySys_GetObject("argv");
if (av != NULL) {
@ -74,7 +77,6 @@ init_gimpui(void)
"ignoring sys.argv: it must be a list of strings");
}
gimp_ui_init(prog_name, FALSE);
pygimp_init_pygobject();