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/db/collection.c | |
parent | 36945bffa2ca648b58c99905ebf9b1b536a9188a (diff) |
Reorganized the Python plugin code.
Diffstat (limited to 'plugins/pychrysalide/analysis/db/collection.c')
-rw-r--r-- | plugins/pychrysalide/analysis/db/collection.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/plugins/pychrysalide/analysis/db/collection.c b/plugins/pychrysalide/analysis/db/collection.c index 80fcfc2..7f8ac2d 100644 --- a/plugins/pychrysalide/analysis/db/collection.c +++ b/plugins/pychrysalide/analysis/db/collection.c @@ -32,6 +32,7 @@ #include <analysis/db/collection.h> +#include "../../access.h" #include "../../helpers.h" @@ -93,17 +94,24 @@ PyTypeObject *get_python_db_collection_type(void) * * ******************************************************************************/ -bool register_python_db_collection(PyObject *module) +bool ensure_python_db_collection_is_registered(void) { - PyTypeObject *py_db_collection_type; /* Type Python 'DbCollection' */ + PyTypeObject *type; /* Type Python 'DbCollection' */ + PyObject *module; /* Module à recompléter */ PyObject *dict; /* Dictionnaire du module */ - py_db_collection_type = get_python_db_collection_type(); + type = get_python_db_collection_type(); - dict = PyModule_GetDict(module); + if (!PyType_HasFeature(type, Py_TPFLAGS_READY)) + { + module = get_access_to_python_module("pychrysalide.format"); - if (!register_class_for_pygobject(dict, G_TYPE_DB_COLLECTION, py_db_collection_type, &PyGObject_Type)) - return false; + dict = PyModule_GetDict(module); + + if (!register_class_for_pygobject(dict, G_TYPE_DB_COLLECTION, type, &PyGObject_Type)) + return false; + + } return true; |