diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2024-11-02 22:03:25 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2024-11-02 22:03:25 (GMT) |
commit | 1bef27ee10a820ceabdcfc6389e61b7fab934eea (patch) | |
tree | 2194de32593137d3bfda7256c1e65cb1743e70db /plugins/pychrysalide/core/nox.c | |
parent | 699e2811a9305f871fe9adcb4797461e947cc863 (diff) |
Load UI plugins only in case of graphical support.
Diffstat (limited to 'plugins/pychrysalide/core/nox.c')
-rw-r--r-- | plugins/pychrysalide/core/nox.c | 110 |
1 files changed, 110 insertions, 0 deletions
diff --git a/plugins/pychrysalide/core/nox.c b/plugins/pychrysalide/core/nox.c new file mode 100644 index 0000000..46a4847 --- /dev/null +++ b/plugins/pychrysalide/core/nox.c @@ -0,0 +1,110 @@ + +/* Chrysalide - Outil d'analyse de fichiers binaires + * nox.c - équivalent Python du fichier "core/nox.c" + * + * Copyright (C) 2024 Cyrille Bagard + * + * This file is part of Chrysalide. + * + * Chrysalide is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * Chrysalide is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + + +#include "nox.h" + + +#include <pygobject.h> + + +#include <core/nox.h> +#include <plugins/self.h> + + +#include "../access.h" +#include "../helpers.h" + + + +/* Indique la présence ou l'absence d'un affichage graphique. */ +static PyObject *py_nox_run_in_nox_mode(PyObject *, PyObject *); + + + +/****************************************************************************** +* * +* Paramètres : self = objet Python concerné par l'appel. * +* args = arguments fournis à l'appel. * +* * +* Description : Indique la présence ou l'absence d'un affichage graphique. * +* * +* Retour : Statut à transmettre. * +* * +* Remarques : - * +* * +******************************************************************************/ + +static PyObject *py_nox_run_in_nox_mode(PyObject *self, PyObject *args) +{ + PyObject *result; /* Conversion à retourner */ + bool status; /* Statut à retransmettre */ + +#define NOX_RUN_IN_NOX_MODE_METHOD PYTHON_METHOD_DEF \ +( \ + run_in_nox_mode, "", \ + METH_NOARGS, py_nox, \ + "Tell if Chrysalide runs with a graphical support or not." \ + "\n" \ + "The result is a boolean status: *True* in case of terminal only mode." \ +) + + status = run_in_nox_mode(); + + result = status ? Py_True : Py_False; + Py_INCREF(result); + + return result; + +} + + +/****************************************************************************** +* * +* Paramètres : - * +* * +* Description : Définit une extension du module 'core' à compléter. * +* * +* Retour : Bilan de l'opération. * +* * +* Remarques : - * +* * +******************************************************************************/ + +bool populate_core_module_with_nox(void) +{ + bool result; /* Bilan à retourner */ + PyObject *module; /* Module à recompléter */ + + static PyMethodDef py_nox_methods[] = { + NOX_RUN_IN_NOX_MODE_METHOD, + { NULL } + }; + + module = get_access_to_python_module("pychrysalide.core"); + + result = register_python_module_methods(module, py_nox_methods); + + return result; + +} |