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:
@ -372,6 +372,7 @@ def _interact(proc_name, start_params):
|
|||||||
import gimpui
|
import gimpui
|
||||||
import gtk
|
import gtk
|
||||||
# import pango
|
# import pango
|
||||||
|
gimpui.gimp_ui_init ()
|
||||||
|
|
||||||
defaults = _get_defaults(proc_name)
|
defaults = _get_defaults(proc_name)
|
||||||
defaults = defaults[len(start_params):]
|
defaults = defaults[len(start_params):]
|
||||||
|
|||||||
@ -54,6 +54,10 @@ class plugin:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def _run(self, name, params):
|
def _run(self, name, params):
|
||||||
|
import sys
|
||||||
|
if "gimpui" in sys.modules.keys():
|
||||||
|
sys.modules["gimpui"].gimp_ui_init ()
|
||||||
|
|
||||||
if hasattr(self, name):
|
if hasattr(self, name):
|
||||||
return apply(getattr(self, name), params)
|
return apply(getattr(self, name), params)
|
||||||
else:
|
else:
|
||||||
|
|||||||
@ -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
|
(define-function gimp_enum_combo_box_new_with_model
|
||||||
(c-name "gimp_enum_combo_box_new_with_model")
|
(c-name "gimp_enum_combo_box_new_with_model")
|
||||||
(return-type "GtkWidget*")
|
(return-type "GtkWidget*")
|
||||||
|
|||||||
@ -2061,3 +2061,15 @@ _wrap_gimp_zoom_preview_get_source(PyGObject *self)
|
|||||||
|
|
||||||
return Py_BuildValue("(Niii)", pyimage, width, height, bpp);
|
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;
|
||||||
|
}
|
||||||
|
|||||||
@ -57,12 +57,15 @@ init_pycairo(void)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern const char *prog_name;
|
||||||
|
|
||||||
|
const char *prog_name = "pygimp";
|
||||||
|
|
||||||
PyMODINIT_FUNC
|
PyMODINIT_FUNC
|
||||||
init_gimpui(void)
|
init_gimpui(void)
|
||||||
{
|
{
|
||||||
PyObject *m, *d;
|
PyObject *m, *d;
|
||||||
PyObject *av;
|
PyObject *av;
|
||||||
char *prog_name = "pygimp";
|
|
||||||
|
|
||||||
av = PySys_GetObject("argv");
|
av = PySys_GetObject("argv");
|
||||||
if (av != NULL) {
|
if (av != NULL) {
|
||||||
@ -74,7 +77,6 @@ init_gimpui(void)
|
|||||||
"ignoring sys.argv: it must be a list of strings");
|
"ignoring sys.argv: it must be a list of strings");
|
||||||
}
|
}
|
||||||
|
|
||||||
gimp_ui_init(prog_name, FALSE);
|
|
||||||
|
|
||||||
pygimp_init_pygobject();
|
pygimp_init_pygobject();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user