diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2025-04-02 09:11:31 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2025-04-02 09:11:31 (GMT) |
commit | e123e6ec3a15ead9352e97104ec13b252e6724c4 (patch) | |
tree | aecf5d60c38ee2b40aa404acb71ed09925bec94f /plugins/pychrysalide/gtkext | |
parent | 1569c4bb1cd25bed29b887c5c8180e7caffc586b (diff) |
Restore support for GTK extra widgets Python bindings.
Diffstat (limited to 'plugins/pychrysalide/gtkext')
-rw-r--r-- | plugins/pychrysalide/gtkext/Makefile.am | 30 | ||||
-rw-r--r-- | plugins/pychrysalide/gtkext/module.c | 34 | ||||
-rw-r--r-- | plugins/pychrysalide/gtkext/panel.c | 130 | ||||
-rw-r--r-- | plugins/pychrysalide/gtkext/panel.h | 42 |
4 files changed, 207 insertions, 29 deletions
diff --git a/plugins/pychrysalide/gtkext/Makefile.am b/plugins/pychrysalide/gtkext/Makefile.am index 2e1260f..1d91751 100644 --- a/plugins/pychrysalide/gtkext/Makefile.am +++ b/plugins/pychrysalide/gtkext/Makefile.am @@ -1,19 +1,23 @@ noinst_LTLIBRARIES = libpychrysagtkext.la +# libpychrysagtkext_la_SOURCES = \ +# blockdisplay.h blockdisplay.c \ +# bufferdisplay.h bufferdisplay.c \ +# displaypanel.h displaypanel.c \ +# dockable.h dockable.c \ +# easygtk.h easygtk.c \ +# module.h module.c \ +# named.h named.c + libpychrysagtkext_la_SOURCES = \ - blockdisplay.h blockdisplay.c \ - bufferdisplay.h bufferdisplay.c \ - displaypanel.h displaypanel.c \ - dockable.h dockable.c \ - easygtk.h easygtk.c \ - module.h module.c \ - named.h named.c - -libpychrysagtkext_la_LIBADD = \ - graph/libpychrysagtkextgraph.la - -libpychrysagtkext_la_CFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) $(LIBPYTHON_INTERPRETER_CFLAGS) $(LIBPYGOBJECT_CFLAGS) \ + panel.h panel.c \ + module.h module.c + +# libpychrysagtkext_la_LIBADD = \ +# graph/libpychrysagtkextgraph.la + +libpychrysagtkext_la_CFLAGS = $(LIBGTK4_CFLAGS) $(LIBPYTHON_INTERPRETER_CFLAGS) $(LIBPYGOBJECT_CFLAGS) \ -I$(top_srcdir)/src -DNO_IMPORT_PYGOBJECT @@ -22,4 +26,4 @@ devdir = $(includedir)/chrysalide/$(subdir) dev_HEADERS = $(libpychrysagtkext_la_SOURCES:%c=) -SUBDIRS = graph +#SUBDIRS = graph diff --git a/plugins/pychrysalide/gtkext/module.c b/plugins/pychrysalide/gtkext/module.c index f8264af..fa59b2b 100644 --- a/plugins/pychrysalide/gtkext/module.c +++ b/plugins/pychrysalide/gtkext/module.c @@ -2,7 +2,7 @@ /* Chrysalide - Outil d'analyse de fichiers binaires * module.c - intégration du répertoire gtkext en tant que module * - * Copyright (C) 2018-2019 Cyrille Bagard + * Copyright (C) 2018-2025 Cyrille Bagard * * This file is part of Chrysalide. * @@ -28,13 +28,13 @@ #include <assert.h> -#include "blockdisplay.h" -#include "bufferdisplay.h" -#include "displaypanel.h" -#include "dockable.h" -#include "easygtk.h" -#include "named.h" -#include "graph/module.h" +//#include "blockdisplay.h" +//#include "bufferdisplay.h" +//#include "displaypanel.h" +//#include "dockable.h" +//#include "named.h" +#include "panel.h" +//#include "graph/module.h" #include "../helpers.h" @@ -71,7 +71,7 @@ bool add_gtkext_module(PyObject *super) result = (module != NULL); - if (result) result = add_gtkext_graph_module(module); + //if (result) result = add_gtkext_graph_module(module); if (!result) Py_XDECREF(module); @@ -99,14 +99,16 @@ bool populate_gtkext_module(void) result = true; - if (result) result = ensure_python_block_display_is_registered(); - if (result) result = ensure_python_buffer_display_is_registered(); - if (result) result = ensure_python_display_panel_is_registered(); - if (result) result = ensure_python_dockable_is_registered(); - if (result) result = ensure_python_easygtk_is_registered(); - if (result) result = ensure_python_built_named_widget_is_registered(); + if (result) result = ensure_python_tiled_panel_is_registered(); - if (result) result = populate_gtkext_graph_module(); + //if (result) result = ensure_python_block_display_is_registered(); + //if (result) result = ensure_python_buffer_display_is_registered(); + //if (result) result = ensure_python_display_panel_is_registered(); + //if (result) result = ensure_python_dockable_is_registered(); + //if (result) result = ensure_python_easygtk_is_registered(); + //if (result) result = ensure_python_built_named_widget_is_registered(); + + //if (result) result = populate_gtkext_graph_module(); assert(result); diff --git a/plugins/pychrysalide/gtkext/panel.c b/plugins/pychrysalide/gtkext/panel.c new file mode 100644 index 0000000..9f6589a --- /dev/null +++ b/plugins/pychrysalide/gtkext/panel.c @@ -0,0 +1,130 @@ + +/* Chrysalide - Outil d'analyse de fichiers binaires + * panel.c - prototypes pour l'équivalent Python du fichier "gtkext/panel.c" + * + * Copyright (C) 2025 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 "panel.h" + + +#include <pygobject.h> + + +#include <gtkext/panel.h> + + +#include "../access.h" +#include "../helpers.h" +#include "../helpers-ui.h" + + + +#define TILED_PANEL_DOC \ + "The TiledPanel class defines a panel widget for the framework main" \ + " window." + + + +/****************************************************************************** +* * +* Paramètres : - * +* * +* Description : Fournit un accès à une définition de type à diffuser. * +* * +* Retour : Définition d'objet pour Python. * +* * +* Remarques : - * +* * +******************************************************************************/ + +PyTypeObject *get_python_tiled_panel_type(void) +{ + static PyMethodDef py_tiled_panel_methods[] = { + { NULL } + }; + + static PyGetSetDef py_tiled_panel_getseters[] = { + { NULL } + }; + + static PyTypeObject py_tiled_panel_type = { + + PyVarObject_HEAD_INIT(NULL, 0) + + .tp_name = "pychrysalide.gtkext.TiledPanel", + .tp_basicsize = sizeof(PyGObject), + + .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, + + .tp_doc = TILED_PANEL_DOC, + + .tp_methods = py_tiled_panel_methods, + .tp_getset = py_tiled_panel_getseters, + + }; + + static PyTypeObject *result = NULL; + + if (result == NULL) + result = define_python_dynamic_type(&py_tiled_panel_type); + + return result; + +} + + +/****************************************************************************** +* * +* Paramètres : - * +* * +* Description : Prend en charge l'objet 'pychrysalide.gtkext.TiledPanel'. * +* * +* Retour : Bilan de l'opération. * +* * +* Remarques : - * +* * +******************************************************************************/ + +bool ensure_python_tiled_panel_is_registered(void) +{ + PyTypeObject *type; /* Type Python 'TiledPanel' */ + PyObject *module; /* Module à recompléter */ + PyObject *dict; /* Dictionnaire du module */ + + type = get_python_tiled_panel_type(); + + if (!PyType_HasFeature(type, Py_TPFLAGS_READY)) + { + module = get_access_to_python_module("pychrysalide.gtkext"); + + dict = PyModule_GetDict(module); + + if (!ensure_gtk_widget_is_registered()) + return false; + + if (!register_class_for_pygobject(dict, GTK_TYPE_TILED_PANEL, type)) + return false; + + } + + return true; + +} diff --git a/plugins/pychrysalide/gtkext/panel.h b/plugins/pychrysalide/gtkext/panel.h new file mode 100644 index 0000000..c5cbe86 --- /dev/null +++ b/plugins/pychrysalide/gtkext/panel.h @@ -0,0 +1,42 @@ + +/* Chrysalide - Outil d'analyse de fichiers binaires + * panel.h - prototypes pour l'équivalent Python du fichier "gtkext/panel.h" + * + * Copyright (C) 2025 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_GTKEXT_PANEL_H +#define _PLUGINS_PYCHRYSALIDE_GTKEXT_PANEL_H + + +#include <Python.h> +#include <stdbool.h> + + + +/* Fournit un accès à une définition de type à diffuser. */ +PyTypeObject *get_python_tiled_panel_type(void); + +/* Prend en charge l'objet 'pychrysalide.gtkext.TiledPanel'. */ +bool ensure_python_tiled_panel_is_registered(void); + + + +#endif /* _PLUGINS_PYCHRYSALIDE_GTKEXT_PANEL_H */ |