diff options
Diffstat (limited to 'plugins/pychrysalide/format/flat.c')
-rw-r--r-- | plugins/pychrysalide/format/flat.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/plugins/pychrysalide/format/flat.c b/plugins/pychrysalide/format/flat.c index c85ee37..18ad414 100644 --- a/plugins/pychrysalide/format/flat.c +++ b/plugins/pychrysalide/format/flat.c @@ -32,6 +32,7 @@ #include "executable.h" +#include "../access.h" #include "../helpers.h" #include "../analysis/content.h" @@ -188,18 +189,27 @@ PyTypeObject *get_python_flat_format_type(void) * * ******************************************************************************/ -bool register_python_flat_format(PyObject *module) +bool ensure_python_flat_format_is_registered(void) { - PyTypeObject *py_flat_format_type; /* Type Python 'FlatFormat' */ + PyTypeObject *type; /* Type Python 'FlatFormat' */ + PyObject *module; /* Module à recompléter */ PyObject *dict; /* Dictionnaire du module */ - py_flat_format_type = get_python_flat_format_type(); + type = get_python_flat_format_type(); - dict = PyModule_GetDict(module); + if (!PyType_HasFeature(type, Py_TPFLAGS_READY)) + { + module = get_access_to_python_module("pychrysalide.format"); + + dict = PyModule_GetDict(module); + + if (!ensure_python_executable_format_is_registered()) + return false; - if (!register_class_for_pygobject(dict, G_TYPE_FLAT_FORMAT, py_flat_format_type, \ - get_python_executable_format_type())) - return false; + if (!register_class_for_pygobject(dict, G_TYPE_FLAT_FORMAT, type, get_python_executable_format_type())) + return false; + + } return true; |