diff options
Diffstat (limited to 'plugins/pychrysalide/plugin.c')
-rw-r--r-- | plugins/pychrysalide/plugin.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/plugins/pychrysalide/plugin.c b/plugins/pychrysalide/plugin.c index f232548..a693d7b 100644 --- a/plugins/pychrysalide/plugin.c +++ b/plugins/pychrysalide/plugin.c @@ -104,6 +104,9 @@ static void g_python_plugin_process_disass(const GPythonPlugin *, PluginAction, /* ------------------------- MODULE PYTHON POUR LES SCRIPTS ------------------------- */ +/* Affiche un message dans le journal des messages système. */ +static PyObject *py_plugin_module_log_message(PyObject *, PyObject *); + /* Définit les constantes pour les greffons en Python. */ static bool py_plugin_module_define_constants(PyTypeObject *); @@ -895,6 +898,54 @@ static void g_python_plugin_process_disass(const GPythonPlugin *plugin, PluginAc /****************************************************************************** * * +* Paramètres : self = objet Python concerné par l'appel. * +* args = arguments fournis à l'appel. * +* * +* Description : Affiche un message dans le journal des messages système. * +* * +* Retour : Rien en équivalent Python. * +* * +* Remarques : - * +* * +******************************************************************************/ + +static PyObject *py_plugin_module_log_message(PyObject *self, PyObject *args) +{ + PyObject *result; /* Bilan à retourner */ + unsigned long type; /* Espèce du message */ + const char *msg; /* Contenu du message */ + + if (!PyArg_ParseTuple(args, "ks", &type, &msg)) + return NULL; + + switch (type) + { + case LMT_INFO: + case LMT_PROCESS: + case LMT_WARNING: + case LMT_BAD_BINARY: + case LMT_ERROR: + case LMT_EXT_ERROR: + /*g_plugin_module_*/log_simple_message(/*G_PLUGIN_MODULE(pygobject_get(self)), */type, msg); + result = Py_None; + Py_INCREF(result); + break; + + default: + PyErr_SetString(PyExc_ValueError, + _("Invalid type of message")); + result = NULL; + break; + + } + + return result; + +} + + +/****************************************************************************** +* * * Paramètres : obj_type = type dont le dictionnaire est à compléter. * * * * Description : Définit les constantes pour les greffons en Python. * @@ -962,6 +1013,11 @@ static bool py_plugin_module_define_constants(PyTypeObject *obj_type) PyTypeObject *get_python_plugin_module_type(void) { static PyMethodDef py_plugin_module_methods[] = { + { + "log_message", py_plugin_module_log_message, + METH_VARARGS, + "log_message(type, msg, /)\n--\n\nDisplay a message in the log window, if any." + }, { NULL } }; |