diff options
| author | Cyrille Bagard <nocbos@gmail.com> | 2018-12-27 22:09:55 (GMT) | 
|---|---|---|
| committer | Cyrille Bagard <nocbos@gmail.com> | 2018-12-27 22:09:55 (GMT) | 
| commit | c8dce9ce407b2f8248d669df196a4bf0f9523723 (patch) | |
| tree | f7ea7baa0c83fb2de1ae8e402b342e345493cdc3 /plugins/pychrysalide/pychrysa.c | |
| parent | 4b1367d2fee7be0789744e1db35d6f9200b29163 (diff) | |
Updated the logging features of the Python bindings.
Diffstat (limited to 'plugins/pychrysalide/pychrysa.c')
| -rw-r--r-- | plugins/pychrysalide/pychrysa.c | 33 | 
1 files changed, 30 insertions, 3 deletions
| diff --git a/plugins/pychrysalide/pychrysa.c b/plugins/pychrysalide/pychrysa.c index ff36dab..8849981 100644 --- a/plugins/pychrysalide/pychrysa.c +++ b/plugins/pychrysalide/pychrysa.c @@ -67,8 +67,11 @@ DEFINE_CHRYSALIDE_CONTAINER_PLUGIN("PyChrysalide", "Provides bindings to Python"                                     EMPTY_PG_LIST(.required), AL(PGA_PLUGIN_INIT, PGA_PLUGIN_EXIT, PGA_NATIVE_LOADED)); +/* Conservation d'une référence au greffon pour les messages */ +static GPluginModule *_this = NULL; +  /* Note la nature du chargement */ -static bool _standalone = true; +#define _standalone (_this == NULL)  /* Réceptacle pour le chargement forcé */  static PyObject *_chrysalide_module = NULL; @@ -566,6 +569,8 @@ G_MODULE_EXPORT bool chrysalide_plugin_init(GPluginModule *plugin)      DIR *dir;                               /* Répertoire à parcourir      */      int ret;                                /* Bilan de préparatifs        */ +    _this = plugin; +      /* Définition des zones d'influence */      dir = opendir(PLUGINS_DATA_DIR G_DIR_SEPARATOR_S "python"); @@ -585,8 +590,6 @@ G_MODULE_EXPORT bool chrysalide_plugin_init(GPluginModule *plugin)      /* Chargement du module pour Python */ -    _standalone = false; -      ret = PyImport_AppendInittab("pychrysalide", &PyInit_pychrysalide);      if (ret == -1) @@ -695,3 +698,27 @@ PyThreadState *get_pychrysalide_main_tstate(void)      return result;  } + + + +/****************************************************************************** +*                                                                             * +*  Paramètres  : msg = message à faire apparaître à l'écran.                  * +*                                                                             * +*  Description : Présente dans le journal un message simple.                  * +*                                                                             * +*  Retour      : -                                                            * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +void log_pychrysalide_simple_message(LogMessageType type, const char *msg) +{ +    if (_this != NULL) +        g_plugin_module_log_simple_message(_this, type, msg); + +    else +        log_simple_message(type, msg); + +} | 
