summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/gui/core
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2019-11-11 18:47:15 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2019-11-11 18:47:15 (GMT)
commit04f9aebee5249624ccd4173989354cd93474376f (patch)
tree90c23774e2898be78a372650a6d6d219104196fb /plugins/pychrysalide/gui/core
parent77c68b54d4b2970a749eb4a658c32d2a16deacf6 (diff)
Extended the Python bindings.
Diffstat (limited to 'plugins/pychrysalide/gui/core')
-rw-r--r--plugins/pychrysalide/gui/core/global.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/plugins/pychrysalide/gui/core/global.c b/plugins/pychrysalide/gui/core/global.c
index 40f6b6e..26d51cb 100644
--- a/plugins/pychrysalide/gui/core/global.c
+++ b/plugins/pychrysalide/gui/core/global.c
@@ -39,6 +39,9 @@
/* Fournit l'adresse de la fenêtre principale de l'éditeur. */
static PyObject *py_global_get_editor_window(PyObject *, PyObject *);
+/* Fournit le contenu actif en cours d'étude. */
+static PyObject *py_global_get_current_content(PyObject *, PyObject *);
+
/******************************************************************************
@@ -86,6 +89,51 @@ static PyObject *py_global_get_editor_window(PyObject *self, PyObject *args)
/******************************************************************************
* *
+* Paramètres : self = objet Python concerné par l'appel. *
+* args = non utilisé ici. *
+* *
+* Description : Fournit le contenu actif en cours d'étude. *
+* *
+* Retour : Instance courante de contenu étudié ou None. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static PyObject *py_global_get_current_content(PyObject *self, PyObject *args)
+{
+ PyObject *result; /* Instance Python à retourner */
+ GLoadedContent *content; /* Contenu courant récupéré */
+
+#define GLOBAL_GET_CURRENT_CONTENT_METHOD PYTHON_METHOD_DEF \
+( \
+ get_current_content, "", \
+ METH_NOARGS, py_global, \
+ "Provide access to the active loaded content, as a" \
+ " pychrysalide.analysis.LoadedContent instance, or None" \
+ " if no current content is loaded." \
+)
+
+ content = get_current_content();
+
+ if (content != NULL)
+ {
+ result = pygobject_new(G_OBJECT(content));
+ g_object_unref(G_OBJECT(content));
+ }
+ else
+ {
+ result = Py_None;
+ Py_INCREF(result);
+ }
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : - *
* *
* Description : Définit une extension du module 'core' à compléter. *
@@ -103,6 +151,7 @@ bool populate_gui_core_module_with_global(void)
static PyMethodDef py_global_methods[] = {
GLOBAL_GET_EDITOR_WINDOW_METHOD,
+ GLOBAL_GET_CURRENT_CONTENT_METHOD,
{ NULL }
};