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/glibext/loadedpanel.c | |
parent | 36945bffa2ca648b58c99905ebf9b1b536a9188a (diff) |
Reorganized the Python plugin code.
Diffstat (limited to 'plugins/pychrysalide/glibext/loadedpanel.c')
-rw-r--r-- | plugins/pychrysalide/glibext/loadedpanel.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/plugins/pychrysalide/glibext/loadedpanel.c b/plugins/pychrysalide/glibext/loadedpanel.c index ba4ced0..44f7ce6 100644 --- a/plugins/pychrysalide/glibext/loadedpanel.c +++ b/plugins/pychrysalide/glibext/loadedpanel.c @@ -31,6 +31,7 @@ #include <glibext/gloadedpanel.h> +#include "../access.h" #include "../helpers.h" @@ -229,18 +230,25 @@ PyTypeObject *get_python_loaded_panel_type(void) * * ******************************************************************************/ -bool register_python_loaded_panel(PyObject *module) +bool ensure_python_loaded_panel_is_registered(void) { - PyTypeObject *py_loaded_panel_type; /* Type Python 'LineGenerator' */ + PyTypeObject *type; /* Type Python 'LineGenerator' */ + PyObject *module; /* Module à recompléter */ PyObject *dict; /* Dictionnaire du module */ - py_loaded_panel_type = get_python_loaded_panel_type(); + type = get_python_loaded_panel_type(); - dict = PyModule_GetDict(module); - pyg_register_interface(dict, "LoadedPanel", G_TYPE_LOADED_PANEL, py_loaded_panel_type); + if (!PyType_HasFeature(type, Py_TPFLAGS_READY)) + { + module = get_access_to_python_module("pychrysalide.glibext"); - if (!py_loaded_panel_define_constants(py_loaded_panel_type)) - return false; + dict = PyModule_GetDict(module); + pyg_register_interface(dict, "LoadedPanel", G_TYPE_LOADED_PANEL, type); + + if (!py_loaded_panel_define_constants(type)) + return false; + + } return true; |