diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2021-02-13 23:03:54 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2021-02-13 23:03:54 (GMT) |
commit | 6c898505ec8b018a32683feb7d5dc598390ec677 (patch) | |
tree | 34450721efaac691ea6da5d0b2a1e726ae343920 /plugins/pychrysalide/plugins/plugin.c | |
parent | d67565b24c0ac7d12e8b1d3385ba45e72a8c3863 (diff) |
Give access to the plugin interfaces from Python.
Diffstat (limited to 'plugins/pychrysalide/plugins/plugin.c')
-rw-r--r-- | plugins/pychrysalide/plugins/plugin.c | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/plugins/pychrysalide/plugins/plugin.c b/plugins/pychrysalide/plugins/plugin.c index c1cc794..bd9cdfe 100644 --- a/plugins/pychrysalide/plugins/plugin.c +++ b/plugins/pychrysalide/plugins/plugin.c @@ -40,6 +40,7 @@ #include "constants.h" +#include "translate.h" #include "../access.h" #include "../core.h" #include "../helpers.h" @@ -148,6 +149,9 @@ static PyObject *py_plugin_module_get_modname(PyObject *, void *); /* Indique le fichier contenant le greffon manipulé. */ static PyObject *py_plugin_module_get_filename(PyObject *, void *); +/* Fournit la description du greffon dans son intégralité. */ +static PyObject *py_plugin_module_get_interface(PyObject *, void *); + /* ---------------------------------------------------------------------------------- */ @@ -1736,6 +1740,64 @@ static PyObject *py_plugin_module_get_filename(PyObject *self, void *closure) * Paramètres : self = objet Python concerné par l'appel. * * closure = non utilisé ici. * * * +* Description : Fournit la description du greffon dans son intégralité. * +* * +* Retour : Interfaçage renseigné. * +* * +* Remarques : - * +* * +******************************************************************************/ + +static PyObject *py_plugin_module_get_interface(PyObject *self, void *closure) +{ + PyObject *result; /* Valeur à retourner */ + GPluginModule *plugin; /* Version native du greffon */ + const plugin_interface *iface; /* Interface liée à traduire */ + +#define PLUGIN_MODULE_INTERFACE_ATTRIB PYTHON_GET_DEF_FULL \ +( \ + interface, py_plugin_module, \ + "Interface exported by the plugin..\n" \ + "\n" \ + "This property is a pychrysalide.StructObject instance." \ + "\n" \ + "The provided information is composed of the following" \ + " properties :\n" \ + "\n" \ + "* gtp_name;\n" \ + "* name;\n" \ + "* desc;\n" \ + "* version;\n" \ + "* url;\n" \ + "* container;\n" \ + "* required;\n" \ + "* actions.\n" \ + "\n" \ + "The *gtp_name* value may be *None* for non-native plugin." \ + " All other fields carry a string value except:\n" \ + "* *container*: a boolean status indicating if the plugin" \ + " can embed other plugins;\n" \ + "* *required*: a tuple of depedencies names;\n" \ + "* *actions*: a tuple of available features from the plugin"\ + " coded as pychrysalide.plugins.PluginModule.PluginAction" \ + " values." \ +) + + plugin = G_PLUGIN_MODULE(pygobject_get(self)); + iface = g_plugin_module_get_interface(plugin); + + result = translate_plugin_interface_to_python(iface); + + return result; + +} + + +/****************************************************************************** +* * +* Paramètres : self = objet Python concerné par l'appel. * +* closure = non utilisé ici. * +* * * Description : Fournit la configuration mise en place pour le greffon. * * * * Retour : Configuration dédiée à l'extension. * @@ -1821,6 +1883,7 @@ PyTypeObject *get_python_plugin_module_type(void) static PyGetSetDef py_plugin_module_getseters[] = { PLUGIN_MODULE_MODNAME_ATTRIB, PLUGIN_MODULE_FILENAME_ATTRIB, + PLUGIN_MODULE_INTERFACE_ATTRIB, PLUGIN_MODULE_CONFIG_ATTRIB, { NULL } }; |