summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/helpers.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-12-11 21:20:53 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-12-11 21:20:53 (GMT)
commit9d74efa39abcbe68b102ceff79c8d61766387f53 (patch)
tree1c061671b67374a83f8e8a7f9d7f9b7ec5ee31bf /plugins/pychrysalide/helpers.c
parent9e3c072316b1183c256595f394f3ca22f2d2b66e (diff)
Collected all Python bindings features using a fake module.
Diffstat (limited to 'plugins/pychrysalide/helpers.c')
-rw-r--r--plugins/pychrysalide/helpers.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/plugins/pychrysalide/helpers.c b/plugins/pychrysalide/helpers.c
index 51c2f31..3a67e2b 100644
--- a/plugins/pychrysalide/helpers.c
+++ b/plugins/pychrysalide/helpers.c
@@ -458,6 +458,11 @@ bool _register_class_for_pygobject(PyObject *dict, GType gtype, PyTypeObject *ty
PyObject *static_bases; /* Base(s) de l'objet */
va_list ap; /* Parcours des arguments */
PyTypeObject *static_base; /* Base à rajouter à la liste */
+ PyObject *features; /* Module à recompléter */
+ PyObject *features_dict; /* Dictionnaire à compléter */
+ char *name; /* Désignation de la classe */
+ PyObject *item; /* Nouvel élément à exporter */
+ int ret; /* Bilan d'une insertion */
/**
* pygobject_register_class() définit type->tp_base à partir des arguments fournis,
@@ -531,6 +536,31 @@ bool _register_class_for_pygobject(PyObject *dict, GType gtype, PyTypeObject *ty
assert(PyErr_Occurred() == NULL);
+ /**
+ * Création d'un dictionnaire complet pour la simulation d'un "import *".
+ */
+
+ if (result)
+ {
+ features = get_access_to_python_module("pychrysalide.features");
+
+ features_dict = PyModule_GetDict(features);
+
+ name = strrchr(type->tp_name, '.');
+ assert(name != NULL);
+
+ name++;
+
+ item = PyDict_GetItemString(dict, name);
+ assert(item != NULL);
+
+ ret = PyDict_SetItemString(features_dict, name, item);
+ assert(ret == 0);
+
+ result = (ret == 0);
+
+ }
+
return result;
}