summaryrefslogtreecommitdiff
path: root/plugins
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
parent77c68b54d4b2970a749eb4a658c32d2a16deacf6 (diff)
Extended the Python bindings.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/pychrysalide/analysis/loaded.c11
-rw-r--r--plugins/pychrysalide/glibext/Makefile.am1
-rw-r--r--plugins/pychrysalide/glibext/binarycursor.c374
-rw-r--r--plugins/pychrysalide/glibext/binarycursor.h45
-rw-r--r--plugins/pychrysalide/glibext/linecursor.c2
-rw-r--r--plugins/pychrysalide/glibext/linecursor.h2
-rw-r--r--plugins/pychrysalide/glibext/module.c2
-rw-r--r--plugins/pychrysalide/gui/core/global.c49
-rw-r--r--plugins/pychrysalide/gui/editem.c103
9 files changed, 583 insertions, 6 deletions
diff --git a/plugins/pychrysalide/analysis/loaded.c b/plugins/pychrysalide/analysis/loaded.c
index 5fde43c..d25b4d3 100644
--- a/plugins/pychrysalide/analysis/loaded.c
+++ b/plugins/pychrysalide/analysis/loaded.c
@@ -281,6 +281,12 @@ static PyObject *py_loaded_content_get_content(PyObject *self, void *closure)
GLoadedContent *content; /* Version GLib de l'élément */
GBinContent *bincnt; /* Contenu binaire associé */
+#define LOADED_CONTENT_CONTENT_ATTRIB PYTHON_GET_DEF_FULL \
+( \
+ content, py_loaded_content, \
+ "Binary content, provided as a pychrysalide.analysis.BinContent instance." \
+)
+
content = G_LOADED_CONTENT(pygobject_get(self));
bincnt = g_loaded_content_get_content(content);
@@ -325,10 +331,7 @@ PyTypeObject *get_python_loaded_content_type(void)
};
static PyGetSetDef py_loaded_content_getseters[] = {
- {
- "content", py_loaded_content_get_content, NULL,
- "Binary content.", NULL
- },
+ LOADED_CONTENT_CONTENT_ATTRIB,
{ NULL }
};
diff --git a/plugins/pychrysalide/glibext/Makefile.am b/plugins/pychrysalide/glibext/Makefile.am
index 8a6de46..28d27f6 100644
--- a/plugins/pychrysalide/glibext/Makefile.am
+++ b/plugins/pychrysalide/glibext/Makefile.am
@@ -2,6 +2,7 @@
noinst_LTLIBRARIES = libpychrysaglibext.la
libpychrysaglibext_la_SOURCES = \
+ binarycursor.h binarycursor.c \
binportion.h binportion.c \
buffercache.h buffercache.c \
bufferline.h bufferline.c \
diff --git a/plugins/pychrysalide/glibext/binarycursor.c b/plugins/pychrysalide/glibext/binarycursor.c
new file mode 100644
index 0000000..92a4b8c
--- /dev/null
+++ b/plugins/pychrysalide/glibext/binarycursor.c
@@ -0,0 +1,374 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * binarycursor.c - équivalent Python du fichier "glibext/gbinarycursor.h"
+ *
+ * Copyright (C) 2019 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 "binarycursor.h"
+
+
+#include <pygobject.h>
+
+
+#include <i18n.h>
+#include <glibext/gbinarycursor.h>
+
+
+#include "linecursor.h"
+#include "../access.h"
+#include "../helpers.h"
+#include "../arch/vmpa.h"
+
+
+
+/* Crée un nouvel objet Python de type 'BinaryCursor'. */
+static PyObject *py_binary_cursor_new(PyTypeObject *, PyObject *, PyObject *);
+
+/* Met à jour la position suivi dans un panneau de chargement. */
+static PyObject *py_binary_cursor_update(PyObject *, PyObject *);
+
+/* Transmet la position de suivi dans un panneau de chargement. */
+static PyObject *py_binary_cursor_retrieve(PyObject *, PyObject *);
+
+/* Indique la représentation de l'emplacement. */
+static PyObject *py_binary_cursor_get_raw(PyObject *, void *);
+
+/* Précise la représentation de l'emplacement. */
+static int py_binary_cursor_set_raw(PyObject *, PyObject *, void *);
+
+
+
+/******************************************************************************
+* *
+* Paramètres : type = type de l'objet à instancier. *
+* args = arguments fournis à l'appel. *
+* kwds = arguments de type key=val fournis. *
+* *
+* Description : Crée un nouvel objet Python de type 'BinaryCursor'. *
+* *
+* Retour : Instance Python mise en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static PyObject *py_binary_cursor_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+{
+ PyObject *result; /* Instance à retourner */
+ GLineCursor *cursor; /* Création GLib à transmettre */
+
+#define BINARY_CURSOR_DOC \
+ "BinaryCursor handles a position into a disassembly view.\n" \
+ "\n" \
+ "Instances can be created using the following constructor:\n" \
+ "\n" \
+ " BinaryCursor()\n"
+
+ cursor = g_binary_cursor_new();
+
+ g_object_ref_sink(G_OBJECT(cursor));
+ result = pygobject_new(G_OBJECT(cursor));
+ g_object_unref(cursor);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : self = variable non utilisée ici. *
+* args = arguments fournis à l'appel. *
+* *
+* Description : Met à jour la position suivi dans un panneau de chargement. *
+* *
+* Retour : None. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static PyObject *py_binary_cursor_update(PyObject *self, PyObject *args)
+{
+ PyObject *result; /* Instance à retourner */
+ vmpa2t addr; /* Emplacement fourni */
+ int ret; /* Bilan de lecture des args. */
+ GBinaryCursor *cursor; /* Version GLib du type */
+
+#define BINARY_CURSOR_UPDATE_METHOD PYTHON_METHOD_DEF \
+( \
+ update, "$self, addr", \
+ METH_VARARGS, py_binary_cursor, \
+ "Update the location of the cursor.\n" \
+ "\n" \
+ "The *addr* argument must be able to get converted into" \
+ " a pychrysalide.arch.vmpa instance." \
+)
+
+ ret = PyArg_ParseTuple(args, "O&", convert_any_to_vmpa, &addr);
+ if (!ret) return NULL;
+
+ cursor = G_BINARY_CURSOR(pygobject_get(self));
+
+ g_binary_cursor_update(cursor, &addr);
+
+ result = Py_None;
+ Py_INCREF(result);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : self = variable non utilisée ici. *
+* args = arguments fournis à l'appel. *
+* *
+* Description : Transmet la position de suivi dans un panneau de chargement. *
+* *
+* Retour : Emplacement courant. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static PyObject *py_binary_cursor_retrieve(PyObject *self, PyObject *args)
+{
+ PyObject *result; /* Instance à retourner */
+ GBinaryCursor *cursor; /* Version GLib du type */
+ vmpa2t addr; /* Emplacement fourni */
+
+#define BINARY_CURSOR_RETRIEVE_METHOD PYTHON_METHOD_DEF \
+( \
+ retrieve, "$self", \
+ METH_NOARGS, py_binary_cursor, \
+ "Retrieve the location of the cursor.\n" \
+ "\n" \
+ "The result is provided as a pychrysalide.arch.vmpa instance." \
+)
+
+ cursor = G_BINARY_CURSOR(pygobject_get(self));
+
+ g_binary_cursor_retrieve(cursor, &addr);
+
+ result = build_from_internal_vmpa(&addr);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : self = objet Python concerné par l'appel. *
+* closure = non utilisé ici. *
+* *
+* Description : Indique la représentation de l'emplacement. *
+* *
+* Retour : True so la représentation de l'emplacement est brute. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static PyObject *py_binary_cursor_get_raw(PyObject *self, void *closure)
+{
+ PyObject *result; /* Valeur à retourner */
+ GBinaryCursor *cursor; /* Instance à manipuler */
+ bool raw; /* Statut défini */
+
+#define BINARY_CURSOR_RAW_ATTRIB PYTHON_GETSET_DEF_FULL \
+( \
+ raw, py_binary_cursor, \
+ "Type of rendering in the status bar for the binary location." \
+)
+
+ cursor = G_BINARY_CURSOR(pygobject_get(self));
+ raw = g_binary_cursor_is_raw(cursor);
+
+ result = raw ? Py_True : Py_False;
+ Py_INCREF(result);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : self = objet Python concerné par l'appel. *
+* value = valeur fournie à intégrer ou prendre en compte. *
+* closure = adresse non utilisée ici. *
+* *
+* Description : Précise la représentation de l'emplacement. *
+* *
+* Retour : Bilan de l'opération. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static int py_binary_cursor_set_raw(PyObject *self, PyObject *value, void *closure)
+{
+ bool raw; /* Statut à définir */
+ GBinaryCursor *cursor; /* Instance à manipuler */
+
+ raw = (value == Py_True);
+
+ cursor = G_BINARY_CURSOR(pygobject_get(self));
+
+ g_binary_cursor_set_raw(cursor, raw);
+
+ return 0;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : - *
+* *
+* Description : Fournit un accès à une définition de type à diffuser. *
+* *
+* Retour : Définition d'objet pour Python. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+PyTypeObject *get_python_binary_cursor_type(void)
+{
+ static PyMethodDef py_binary_cursor_methods[] = {
+ BINARY_CURSOR_UPDATE_METHOD,
+ BINARY_CURSOR_RETRIEVE_METHOD,
+ { NULL }
+ };
+
+ static PyGetSetDef py_binary_cursor_getseters[] = {
+ BINARY_CURSOR_RAW_ATTRIB,
+ { NULL }
+ };
+
+ static PyTypeObject py_binary_cursor_type = {
+
+ PyVarObject_HEAD_INIT(NULL, 0)
+
+ .tp_name = "pychrysalide.glibext.BinaryCursor",
+ .tp_basicsize = sizeof(PyGObject),
+
+ .tp_flags = Py_TPFLAGS_DEFAULT,
+
+ .tp_doc = BINARY_CURSOR_DOC,
+
+ .tp_methods = py_binary_cursor_methods,
+ .tp_getset = py_binary_cursor_getseters,
+ .tp_new = py_binary_cursor_new,
+
+ };
+
+ return &py_binary_cursor_type;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : module = module dont la définition est à compléter. *
+* *
+* Description : Prend en charge l'objet 'pychrysalide.glibext.BinaryCursor'. *
+* *
+* Retour : Bilan de l'opération. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool ensure_python_binary_cursor_is_registered(void)
+{
+ PyTypeObject *type; /* Type Python 'BinaryCursor' */
+ PyObject *module; /* Module à recompléter */
+ PyObject *dict; /* Dictionnaire du module */
+
+ type = get_python_binary_cursor_type();
+
+ if (!PyType_HasFeature(type, Py_TPFLAGS_READY))
+ {
+ module = get_access_to_python_module("pychrysalide.glibext");
+
+ dict = PyModule_GetDict(module);
+
+ if (!ensure_python_line_cursor_is_registered())
+ return false;
+
+ if (!register_class_for_pygobject(dict, G_TYPE_BINARY_CURSOR, type, get_python_line_cursor_type()))
+ return false;
+
+ }
+
+ return true;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : arg = argument quelconque à tenter de convertir. *
+* dst = destination des valeurs récupérées en cas de succès. *
+* *
+* Description : Tente de convertir en curseur pour ligne. *
+* *
+* Retour : Bilan de l'opération, voire indications supplémentaires. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+int convert_to_binary_cursor(PyObject *arg, void *dst)
+{
+ int result; /* Bilan à retourner */
+
+ result = PyObject_IsInstance(arg, (PyObject *)get_python_binary_cursor_type());
+
+ switch (result)
+ {
+ case -1:
+ /* L'exception est déjà fixée par Python */
+ result = 0;
+ break;
+
+ case 0:
+ PyErr_SetString(PyExc_TypeError, _("unable to convert the provided argument to binary cursor"));
+ break;
+
+ case 1:
+ *((GBinaryCursor **)dst) = G_BINARY_CURSOR(pygobject_get(arg));
+ break;
+
+ default:
+ assert(false);
+ break;
+
+ }
+
+ return result;
+
+}
diff --git a/plugins/pychrysalide/glibext/binarycursor.h b/plugins/pychrysalide/glibext/binarycursor.h
new file mode 100644
index 0000000..9832d8f
--- /dev/null
+++ b/plugins/pychrysalide/glibext/binarycursor.h
@@ -0,0 +1,45 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * binarycursor.h - prototypes pour l'équivalent Python du fichier "glibext/binarycursor.h"
+ *
+ * Copyright (C) 2019 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
+ */
+
+
+#ifndef _PLUGINS_PYCHRYSALIDE_GLIBEXT_BINARYCURSOR_H
+#define _PLUGINS_PYCHRYSALIDE_GLIBEXT_BINARYCURSOR_H
+
+
+#include <Python.h>
+#include <stdbool.h>
+
+
+
+/* Fournit un accès à une définition de type à diffuser. */
+PyTypeObject *get_python_binary_cursor_type(void);
+
+/* Prend en charge l'objet 'pychrysalide.glibext.BinaryCursor'. */
+bool ensure_python_binary_cursor_is_registered(void);
+
+/* Tente de convertir en curseur pour ligne. */
+int convert_to_binary_cursor(PyObject *, void *);
+
+
+
+#endif /* _PLUGINS_PYCHRYSALIDE_GLIBEXT_BINARYCURSOR_H */
diff --git a/plugins/pychrysalide/glibext/linecursor.c b/plugins/pychrysalide/glibext/linecursor.c
index bb3b8ba..edc5696 100644
--- a/plugins/pychrysalide/glibext/linecursor.c
+++ b/plugins/pychrysalide/glibext/linecursor.c
@@ -162,7 +162,7 @@ PyTypeObject *get_python_line_cursor_type(void)
* *
* Paramètres : module = module dont la définition est à compléter. *
* *
-* Description : Prend en charge l'objet 'pychrysalide.glibext.Linecursor'. *
+* Description : Prend en charge l'objet 'pychrysalide.glibext.LineCursor'. *
* *
* Retour : Bilan de l'opération. *
* *
diff --git a/plugins/pychrysalide/glibext/linecursor.h b/plugins/pychrysalide/glibext/linecursor.h
index 896e6bb..ce94c8a 100644
--- a/plugins/pychrysalide/glibext/linecursor.h
+++ b/plugins/pychrysalide/glibext/linecursor.h
@@ -34,7 +34,7 @@
/* Fournit un accès à une définition de type à diffuser. */
PyTypeObject *get_python_line_cursor_type(void);
-/* Prend en charge l'objet 'pychrysalide.glibext.Linecursor'. */
+/* Prend en charge l'objet 'pychrysalide.glibext.LineCursor'. */
bool ensure_python_line_cursor_is_registered(void);
/* Tente de convertir en curseur pour ligne. */
diff --git a/plugins/pychrysalide/glibext/module.c b/plugins/pychrysalide/glibext/module.c
index a30d200..509f36c 100644
--- a/plugins/pychrysalide/glibext/module.c
+++ b/plugins/pychrysalide/glibext/module.c
@@ -28,6 +28,7 @@
#include <assert.h>
+#include "binarycursor.h"
#include "binportion.h"
#include "buffercache.h"
#include "bufferline.h"
@@ -95,6 +96,7 @@ bool populate_glibext_module(void)
result = true;
+ if (result) result = ensure_python_binary_cursor_is_registered();
if (result) result = ensure_python_binary_portion_is_registered();
if (result) result = ensure_python_buffer_cache_is_registered();
if (result) result = ensure_python_buffer_line_is_registered();
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 }
};
diff --git a/plugins/pychrysalide/gui/editem.c b/plugins/pychrysalide/gui/editem.c
index 68962ae..71bf316 100644
--- a/plugins/pychrysalide/gui/editem.c
+++ b/plugins/pychrysalide/gui/editem.c
@@ -51,6 +51,12 @@ static void py_editor_item_change_view_wrapper(GEditorItem *, GLoadedPanel *, GL
/* Réagit à une modification de la vue du contenu analysé. */
static void py_editor_item_update_view_wrapper(GEditorItem *, GLoadedPanel *);
+/* Réagit à une modification de la vue du contenu analysé. */
+static void py_editor_item_track_cursor_wrapper(GEditorItem *, GLoadedPanel *, const GLineCursor *);
+
+/* Réagit à une modification de la vue du contenu analysé. */
+static void py_editor_item_focus_cursor_wrapper(GEditorItem *, GLoadedContent *, const GLineCursor *);
+
/* ---------------------------------------------------------------------------------- */
@@ -77,6 +83,9 @@ void py_editor_item_init_gclass(GEditorItemClass *class, gpointer unused)
class->change_view = py_editor_item_change_view_wrapper;
class->update_view = py_editor_item_update_view_wrapper;
+ class->track_cursor = py_editor_item_track_cursor_wrapper;
+ class->focus_cursor = py_editor_item_focus_cursor_wrapper;
+
}
@@ -255,6 +264,100 @@ static void py_editor_item_update_view_wrapper(GEditorItem *item, GLoadedPanel *
}
+/******************************************************************************
+* *
+* Paramètres : item = instance à consulter. *
+* panel = composant d'affichage parcouru. *
+* cursor = nouvel emplacement du curseur courant. *
+* *
+* Description : Réagit à une modification de la vue du contenu analysé. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void py_editor_item_track_cursor_wrapper(GEditorItem *item, GLoadedPanel *panel, const GLineCursor *cursor)
+{
+ PyObject *pyobj; /* Objet Python concerné */
+ PyThreadState *tstate; /* Contexte d'environnement */
+ PyObject *args; /* Arguments pour l'appel */
+ PyObject *pyret; /* Retour de Python */
+
+ pyobj = pygobject_new(G_OBJECT(item));
+
+ tstate = get_pychrysalide_main_tstate();
+
+ if (tstate != NULL)
+ PyEval_RestoreThread(tstate);
+
+ if (has_python_method(pyobj, "_track_cursor"))
+ {
+ args = PyTuple_New(2);
+ PyTuple_SetItem(args, 0, pygobject_new(G_OBJECT(panel)));
+ PyTuple_SetItem(args, 1, pygobject_new(G_OBJECT(cursor)));
+
+ pyret = run_python_method(pyobj, "_track_cursor", args);
+
+ Py_DECREF(args);
+ Py_DECREF(pyret);
+
+ }
+
+ if (tstate != NULL)
+ PyEval_SaveThread();
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : item = instance à consulter. *
+* content = contenu contenant le curseur à représenter. *
+* cursor = nouvel emplacement du curseur courant. *
+* *
+* Description : Réagit à une modification de la vue du contenu analysé. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void py_editor_item_focus_cursor_wrapper(GEditorItem *item, GLoadedContent *content, const GLineCursor *cursor)
+{
+ PyObject *pyobj; /* Objet Python concerné */
+ PyThreadState *tstate; /* Contexte d'environnement */
+ PyObject *args; /* Arguments pour l'appel */
+ PyObject *pyret; /* Retour de Python */
+
+ pyobj = pygobject_new(G_OBJECT(item));
+
+ tstate = get_pychrysalide_main_tstate();
+
+ if (tstate != NULL)
+ PyEval_RestoreThread(tstate);
+
+ if (has_python_method(pyobj, "_focus_cursor"))
+ {
+ args = PyTuple_New(2);
+ PyTuple_SetItem(args, 0, pygobject_new(G_OBJECT(content)));
+ PyTuple_SetItem(args, 1, pygobject_new(G_OBJECT(cursor)));
+
+ pyret = run_python_method(pyobj, "_focus_cursor", args);
+
+ Py_DECREF(args);
+ Py_DECREF(pyret);
+
+ }
+
+ if (tstate != NULL)
+ PyEval_SaveThread();
+
+}
+
+
/* ---------------------------------------------------------------------------------- */
/* FONCTIONNALITES D'UN ELEMENT */