diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2025-04-02 09:11:31 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2025-04-02 09:11:31 (GMT) |
commit | e123e6ec3a15ead9352e97104ec13b252e6724c4 (patch) | |
tree | aecf5d60c38ee2b40aa404acb71ed09925bec94f /plugins/pychrysalide/bindings.c | |
parent | 1569c4bb1cd25bed29b887c5c8180e7caffc586b (diff) |
Restore support for GTK extra widgets Python bindings.
Diffstat (limited to 'plugins/pychrysalide/bindings.c')
-rw-r--r-- | plugins/pychrysalide/bindings.c | 43 |
1 files changed, 25 insertions, 18 deletions
diff --git a/plugins/pychrysalide/bindings.c b/plugins/pychrysalide/bindings.c index 5bc96a6..f120c3b 100644 --- a/plugins/pychrysalide/bindings.c +++ b/plugins/pychrysalide/bindings.c @@ -53,10 +53,6 @@ #include "glibext/module.h" /* #include "debug/module.h" */ #include "format/module.h" -/* #ifdef INCLUDE_GTK_SUPPORT */ -/* # include "gtkext/module.h" */ -/* # include "gui/module.h" */ -/* #endif */ /* #include "mangling/module.h" */ #include "plugins/module.h" @@ -150,7 +146,7 @@ static void ensure_native_pygobject_type(PyTypeObject **); static PyObject *get_existing_modules(void); /* Définit les différents modules du support Python. */ -static PyObject *create_basic_modules(void); +static PyObject *create_basic_modules(const pyinit_details_t *); /* Inscrit les défintions des objets Python de Chrysalide. */ static bool populate_python_modules(const pyinit_details_t *); @@ -980,7 +976,7 @@ static PyObject *get_existing_modules(void) /****************************************************************************** * * -* Paramètres : - * +* Paramètres : details = précisions de chargement complémentaires. * * * * Description : Définit les différents modules du support Python. * * * @@ -990,7 +986,7 @@ static PyObject *get_existing_modules(void) * * ******************************************************************************/ -static PyObject *create_basic_modules(void) +static PyObject *create_basic_modules(const pyinit_details_t *details) { PyObject *result; /* Module Python à retourner */ bool status; /* Bilan des inclusions */ @@ -1038,14 +1034,17 @@ static PyObject *create_basic_modules(void) */ if (status) status = add_format_module(result); /* -#ifdef INCLUDE_GTK_SUPPORT - if (status) status = add_gtkext_module(result); - if (status) status = add_gui_module(result); -#endif if (status) status = add_mangling_module(result); */ if (status) status = add_plugins_module(result); + /** + * Ajout de modules UI supplémentaires éventuels. + */ + + if (status && details->add_extra != NULL) + status = details->add_extra(result); + if (!status) { Py_DECREF(result); @@ -1083,8 +1082,8 @@ static bool populate_python_modules(const pyinit_details_t *details) * un chargement préliminaire, si besoin est. */ - if (details->populate_extra) - result = details->populate_extra(); + if (details->populate_extra != NULL) + result = details->populate_extra(false); else result = true; @@ -1103,14 +1102,22 @@ static bool populate_python_modules(const pyinit_details_t *details) */ if (result) result = populate_format_module(); /* -#ifdef INCLUDE_GTK_SUPPORT - if (result) result = populate_gtkext_module(); - if (result) result = populate_gui_module(); -#endif if (result) result = populate_mangling_module(); */ if (result) result = populate_plugins_module(); + /** + * Certaines définitions reposent sur une déclinaison de GtkWidget, + * dont le chargement va remplacer la définition statique de GObject + * par une version allouée dynamiquement. + * + * De telles définitions doivent donc être prise en compte à la fin + * du chargement. + */ + + if (result && details->populate_extra != NULL) + result = details->populate_extra(true); + return result; } @@ -1204,7 +1211,7 @@ PyObject *init_python_pychrysalide_module(const pyinit_details_t *details) ensure_native_pygobject_type(&py_gobj_def); - result = create_basic_modules(); + result = create_basic_modules(details); if (result == NULL) PyErr_SetString(PyExc_SystemError, "failed to create all PyChrysalide modules."); |