diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2016-03-08 21:44:52 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2016-03-08 21:46:19 (GMT) |
commit | 235b34006d734d55333a182ffd8bbe7fbf8f54bc (patch) | |
tree | f1c8f75391537c8c187aea46c16b3d2642c92107 /plugins/pychrysa/gui/panels | |
parent | 02e978d601cdcf2ea9bb39ae21207c3b97d16e22 (diff) |
Loaded a dynamic list of dockable panels in the View menu.
Diffstat (limited to 'plugins/pychrysa/gui/panels')
-rw-r--r-- | plugins/pychrysa/gui/panels/panel.c | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/plugins/pychrysa/gui/panels/panel.c b/plugins/pychrysa/gui/panels/panel.c index 3170a66..8046c0e 100644 --- a/plugins/pychrysa/gui/panels/panel.c +++ b/plugins/pychrysa/gui/panels/panel.c @@ -32,6 +32,7 @@ #include "../editem.h" +#include "../../helpers.h" #include "../../quirks.h" @@ -42,6 +43,9 @@ static int py_panel_item_init(PyObject *self, PyObject *args, PyObject *kwds); /* Place un panneau dans l'ensemble affiché. */ static PyObject *py_panel_item_dock(PyObject *, PyObject *); +/* Définit les constantes pour les panneaux. */ +static bool py_panel_item_define_constants(PyTypeObject *); + /****************************************************************************** @@ -60,6 +64,7 @@ static PyObject *py_panel_item_dock(PyObject *, PyObject *); static int py_panel_item_init(PyObject *self, PyObject *args, PyObject *kwds) { + unsigned long personality; /* Nature du panneau */ const char *name; /* Désignation humaine */ const char *lname; /* Nom version longue */ PyGObject *widget; /* Composant visuel du panneau */ @@ -67,10 +72,10 @@ static int py_panel_item_init(PyObject *self, PyObject *args, PyObject *kwds) int ret; /* Bilan de lecture des args. */ GEditorItem *item; /* Elément de l'éditeur */ - ret = PyArg_ParseTuple(args, "ssOs", &name, &lname, &widget, &path); + ret = PyArg_ParseTuple(args, "kssOs", &personality, &name, &lname, &widget, &path); if (!ret) return -1; - item = g_panel_item_new(get_internal_ref(), name, lname, + item = g_panel_item_new(personality, get_internal_ref(), name, lname, GTK_WIDGET(pygobject_get(widget)), path); /* Enregistrement auprès de PyGObject */ @@ -161,6 +166,37 @@ PyTypeObject *get_python_panel_item_type(void) /****************************************************************************** * * +* Paramètres : obj_type = type dont le dictionnaire est à compléter. * +* * +* Description : Définit les constantes pour les panneaux. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static bool py_panel_item_define_constants(PyTypeObject *obj_type) +{ + bool result; /* Bilan à retourner */ + + result = true; + + result &= PyDict_AddIntMacro(obj_type, PIP_INVALID); + + result &= PyDict_AddIntMacro(obj_type, PIP_SINGLETON); + result &= PyDict_AddIntMacro(obj_type, PIP_BINARY_VIEW); + result &= PyDict_AddIntMacro(obj_type, PIP_OTHER); + + result &= PyDict_AddIntMacro(obj_type, PIP_COUNT); + + return result; + +} + + +/****************************************************************************** +* * * Paramètres : module = module dont la définition est à compléter. * * * * Description : Prend en charge l'objet 'pychrysalide.gui.panels.PanelItem'. * @@ -185,6 +221,9 @@ bool register_python_panel_item(PyObject *module) if (PyType_Ready(py_panel_item_type) != 0) return false; + if (!py_panel_item_define_constants(py_panel_item_type)) + return false; + Py_INCREF(py_panel_item_type); ret = PyModule_AddObject(module, "PanelItem", (PyObject *)py_panel_item_type); if (ret != 0) return false; |