diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2018-08-16 09:16:53 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2018-08-16 09:16:53 (GMT) |
commit | fb315963527f6412273829f09513325e446eb6c9 (patch) | |
tree | 361f19767812a8f758545e8daa2973fe0b3c9de7 /plugins/pychrysalide/analysis/project.c | |
parent | 36945bffa2ca648b58c99905ebf9b1b536a9188a (diff) |
Reorganized the Python plugin code.
Diffstat (limited to 'plugins/pychrysalide/analysis/project.c')
-rw-r--r-- | plugins/pychrysalide/analysis/project.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/plugins/pychrysalide/analysis/project.c b/plugins/pychrysalide/analysis/project.c index fa7de72..62ce43b 100644 --- a/plugins/pychrysalide/analysis/project.c +++ b/plugins/pychrysalide/analysis/project.c @@ -33,6 +33,7 @@ #include "loaded.h" +#include "../access.h" #include "../helpers.h" @@ -216,7 +217,7 @@ PyTypeObject *get_python_study_project_type(void) /****************************************************************************** * * -* Paramètres : module = module dont la définition est à compléter. * +* Paramètres : - * * * * Description : Prend en charge l'objet 'pychrysalide.analysis.StudyProject'.* * * @@ -226,17 +227,24 @@ PyTypeObject *get_python_study_project_type(void) * * ******************************************************************************/ -bool register_python_study_project(PyObject *module) +bool ensure_python_study_project_is_registered(void) { - PyTypeObject *py_study_project_type; /* Type Python 'StudyProject' */ + PyTypeObject *type; /* Type Python 'StudyProject' */ + PyObject *module; /* Module à recompléter */ PyObject *dict; /* Dictionnaire du module */ - py_study_project_type = get_python_study_project_type(); + type = get_python_study_project_type(); + + if (!PyType_HasFeature(type, Py_TPFLAGS_READY)) + { + module = get_access_to_python_module("pychrysalide.analysis"); + + dict = PyModule_GetDict(module); - dict = PyModule_GetDict(module); + if (!register_class_for_pygobject(dict, G_TYPE_STUDY_PROJECT, type, &PyGObject_Type)) + return false; - if (!register_class_for_pygobject(dict, G_TYPE_STUDY_PROJECT, py_study_project_type, &PyGObject_Type)) - return false; + } return true; |