[gimp] Bug 761140: importing gimpui module causes plugin query failure
- From: Massimo Valentini <mvalentini src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Bug 761140: importing gimpui module causes plugin query failure
- Date: Wed, 27 Jul 2016 17:45:57 +0000 (UTC)
commit f51acf3bfb9e3ea6d7584041e08f68eb07f70f79
Author: Massimo Valentini <mvalentini src gnome org>
Date: Wed Jul 27 19:07:48 2016 +0200
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.
plug-ins/pygimp/gimpfu.py | 1 +
plug-ins/pygimp/gimpplugin.py | 4 ++++
plug-ins/pygimp/gimpui.defs | 5 +++++
plug-ins/pygimp/gimpui.override | 12 ++++++++++++
plug-ins/pygimp/gimpuimodule.c | 6 ++++--
5 files changed, 26 insertions(+), 2 deletions(-)
---
diff --git a/plug-ins/pygimp/gimpfu.py b/plug-ins/pygimp/gimpfu.py
index 3116a9c..97d9bf2 100644
--- a/plug-ins/pygimp/gimpfu.py
+++ b/plug-ins/pygimp/gimpfu.py
@@ -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):]
diff --git a/plug-ins/pygimp/gimpplugin.py b/plug-ins/pygimp/gimpplugin.py
index a088584..e7b0aae 100644
--- a/plug-ins/pygimp/gimpplugin.py
+++ b/plug-ins/pygimp/gimpplugin.py
@@ -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:
diff --git a/plug-ins/pygimp/gimpui.defs b/plug-ins/pygimp/gimpui.defs
index a74e3cc..0dbbe51 100644
--- a/plug-ins/pygimp/gimpui.defs
+++ b/plug-ins/pygimp/gimpui.defs
@@ -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*")
diff --git a/plug-ins/pygimp/gimpui.override b/plug-ins/pygimp/gimpui.override
index 53576d3..84e559d 100644
--- a/plug-ins/pygimp/gimpui.override
+++ b/plug-ins/pygimp/gimpui.override
@@ -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;
+}
diff --git a/plug-ins/pygimp/gimpuimodule.c b/plug-ins/pygimp/gimpuimodule.c
index a7b6385..68f7cfd 100644
--- a/plug-ins/pygimp/gimpuimodule.c
+++ b/plug-ins/pygimp/gimpuimodule.c
@@ -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();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]