diff options
Diffstat (limited to 'plugins/pychrysalide/plugin.c')
-rw-r--r-- | plugins/pychrysalide/plugin.c | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/plugins/pychrysalide/plugin.c b/plugins/pychrysalide/plugin.c index a916668..cc69dd7 100644 --- a/plugins/pychrysalide/plugin.c +++ b/plugins/pychrysalide/plugin.c @@ -37,6 +37,7 @@ #include <plugins/plugin-int.h> +#include "access.h" #include "helpers.h" @@ -912,7 +913,7 @@ PyTypeObject *get_python_plugin_module_type(void) /****************************************************************************** * * -* Paramètres : module = module dont la définition est à compléter. * +* Paramètres : - * * * * Description : Prend en charge l'objet 'pychrysalide.PluginModule'. * * * @@ -922,20 +923,27 @@ PyTypeObject *get_python_plugin_module_type(void) * * ******************************************************************************/ -bool register_python_plugin_module(PyObject *module) +bool ensure_python_plugin_module_is_registered(void) { - PyTypeObject *py_plugin_module_type; /* Type Python 'PluginModule' */ + PyTypeObject *type; /* Type Python 'PluginModule' */ + PyObject *module; /* Module à recompléter */ PyObject *dict; /* Dictionnaire du module */ - py_plugin_module_type = get_python_plugin_module_type(); + type = get_python_plugin_module_type(); - dict = PyModule_GetDict(module); + if (!PyType_HasFeature(type, Py_TPFLAGS_READY)) + { + module = get_access_to_python_module("pychrysalide"); - if (!register_class_for_pygobject(dict, G_TYPE_PLUGIN_MODULE, py_plugin_module_type, &PyGObject_Type)) - return false; + dict = PyModule_GetDict(module); - if (!py_plugin_module_define_constants(py_plugin_module_type)) - return false; + if (!register_class_for_pygobject(dict, G_TYPE_PLUGIN_MODULE, type, &PyGObject_Type)) + return false; + + if (!py_plugin_module_define_constants(type)) + return false; + + } return true; |