From 593ea949a1fffdb98cc9dbf4c91465e7ebea75c0 Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Sat, 29 Jun 2019 13:50:48 +0200 Subject: Extended the Python API with the running mode. --- plugins/pychrysalide/core/global.c | 40 +++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/plugins/pychrysalide/core/global.c b/plugins/pychrysalide/core/global.c index 0a56825..86133d2 100644 --- a/plugins/pychrysalide/core/global.c +++ b/plugins/pychrysalide/core/global.c @@ -37,6 +37,9 @@ +/* Indique le mode d'exécution courant du programme. */ +static PyObject *py_global_is_batch_mode(PyObject *, PyObject *); + /* Fournit l'adresse de l'explorateur de contenus courant. */ static PyObject *py_global_get_content_explorer(PyObject *, PyObject *); @@ -56,6 +59,41 @@ static PyObject *py_global_set_current_project(PyObject *, PyObject *); * Paramètres : self = objet Python concerné par l'appel. * * args = non utilisé ici. * * * +* Description : Indique le mode d'exécution courant du programme. * +* * +* Retour : True si le fonctionnement est sans interface. * +* * +* Remarques : - * +* * +******************************************************************************/ + +static PyObject *py_global_is_batch_mode(PyObject *self, PyObject *args) +{ + PyObject *result; /* Instance Python à retourner */ + bool status; /* Bilan de consultation */ + +#define GLOBAL_IS_BATCH_MODE_METHOD PYTHON_METHOD_DEF \ +( \ + is_batch_mode, "", \ + METH_NOARGS, py_global, \ + "Tell if Chrysalide is started in batch mode or with a GUI." \ +) + + status = is_batch_mode(); + + result = status ? Py_True : Py_False; + Py_INCREF(result); + + return result; + +} + + +/****************************************************************************** +* * +* Paramètres : self = objet Python concerné par l'appel. * +* args = non utilisé ici. * +* * * Description : Fournit l'adresse de l'explorateur de contenus courant. * * * * Retour : Adresse de l'explorateur global ou None si aucun (!). * @@ -207,7 +245,7 @@ bool populate_core_module_with_global(void) PyObject *module; /* Module à recompléter */ static PyMethodDef py_global_methods[] = { - + GLOBAL_IS_BATCH_MODE_METHOD, { "get_content_explorer", py_global_get_content_explorer, METH_NOARGS, "get_content_explorer(, /)\n--\n\nGet the global exploration manager discovering contents." -- cgit v0.11.2-87-g4458