summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/gui/panels/panel.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/pychrysalide/gui/panels/panel.c')
-rw-r--r--plugins/pychrysalide/gui/panels/panel.c32
1 files changed, 23 insertions, 9 deletions
diff --git a/plugins/pychrysalide/gui/panels/panel.c b/plugins/pychrysalide/gui/panels/panel.c
index 72c9e7e..6613fac 100644
--- a/plugins/pychrysalide/gui/panels/panel.c
+++ b/plugins/pychrysalide/gui/panels/panel.c
@@ -34,6 +34,7 @@
#include "../editem.h"
+#include "../../access.h"
#include "../../helpers.h"
#include "../../gtkext/dockable.h"
@@ -223,21 +224,34 @@ static bool py_panel_item_define_constants(PyTypeObject *obj_type)
* *
******************************************************************************/
-bool register_python_panel_item(PyObject *module)
+bool ensure_python_panel_item_is_registered(void)
{
- PyTypeObject *py_panel_item_type; /* Type Python 'LoadedBinary' */
+ PyTypeObject *type; /* Type Python 'LoadedBinary' */
+ PyObject *module; /* Module à recompléter */
PyObject *dict; /* Dictionnaire du module */
- py_panel_item_type = get_python_panel_item_type();
+ type = get_python_panel_item_type();
- dict = PyModule_GetDict(module);
+ if (!PyType_HasFeature(type, Py_TPFLAGS_READY))
+ {
+ module = get_access_to_python_module("pychrysalide.gui.panels");
- if (!_register_class_for_pygobject(dict, G_TYPE_PANEL_ITEM, py_panel_item_type,
- get_python_editor_item_type(), get_python_gtk_dockable_type(), NULL))
- return false;
+ dict = PyModule_GetDict(module);
- if (!py_panel_item_define_constants(py_panel_item_type))
- return false;
+ if (!ensure_python_editor_item_is_registered())
+ return false;
+
+ if (!ensure_python_gtk_dockable_is_registered())
+ return false;
+
+ if (!_register_class_for_pygobject(dict, G_TYPE_PANEL_ITEM, type,
+ get_python_editor_item_type(), get_python_gtk_dockable_type(), NULL))
+ return false;
+
+ if (!py_panel_item_define_constants(type))
+ return false;
+
+ }
return true;