summaryrefslogtreecommitdiff
path: root/plugins/pychrysa/gui/panels/panel.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/pychrysa/gui/panels/panel.c')
-rw-r--r--plugins/pychrysa/gui/panels/panel.c85
1 files changed, 52 insertions, 33 deletions
diff --git a/plugins/pychrysa/gui/panels/panel.c b/plugins/pychrysa/gui/panels/panel.c
index 826982f..e713cc0 100644
--- a/plugins/pychrysa/gui/panels/panel.c
+++ b/plugins/pychrysa/gui/panels/panel.c
@@ -28,18 +28,24 @@
#include <pygobject.h>
-#include "../../quirks.h"
+#include <gui/panels/panel.h>
+
+
+#include "../editem.h"
/* Crée un nouvel objet Python de type 'PanelItem'. */
+#if 0
static PyObject *py_panel_item_new(PyTypeObject *, PyObject *, PyObject *);
+#endif
/* Place un panneau dans l'ensemble affiché. */
static PyObject *py_panel_item_dock(PyObject *, PyObject *);
+#if 0
/******************************************************************************
* *
* Paramètres : type = type de l'objet à instancier. *
@@ -110,6 +116,7 @@ PyObject *_py_panel_item_from_c(GPanelItem *item, PyTypeObject *type)
return pygobject_new(G_OBJECT(item));
}
+#endif
/******************************************************************************
@@ -138,40 +145,25 @@ static PyObject *py_panel_item_dock(PyObject *self, PyObject *args)
}
-
-
-
-
-
-
-
-
-
-
-
-
/******************************************************************************
* *
-* Paramètres : module = module dont la définition est à compléter. *
+* Paramètres : - *
* *
-* Description : Prend en charge l'objet 'pychrysalide.gui.panels.PanelItem'. *
+* Description : Fournit un accès à une définition de type à diffuser. *
* *
-* Retour : Bilan de l'opération. *
+* Retour : Définition d'objet pour Python. *
* *
* Remarques : - *
* *
******************************************************************************/
-bool register_python_panel_item(PyObject *module)
+PyTypeObject *get_python_panel_item_type(void)
{
- PyObject *parent_mod; /* Module Python-EditorItem */
- int ret; /* Bilan d'un appel */
-
static PyMethodDef py_panel_item_methods[] = {
{
"dock", (PyCFunction)py_panel_item_dock,
METH_NOARGS,
- "Display the panel item in the right place."
+ "dock($self, /)\n--\n\nDisplay the panel item in the right place."
},
{ NULL }
};
@@ -182,34 +174,61 @@ bool register_python_panel_item(PyObject *module)
static PyTypeObject py_panel_item_type = {
- PyObject_HEAD_INIT(NULL)
+ PyVarObject_HEAD_INIT(NULL, 0)
.tp_name = "pychrysalide.gui.panels.PanelItem",
.tp_basicsize = sizeof(PyGObject),
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
- .tp_doc = "PyChrysalide panel item",
+ .tp_doc = "PyChrysalide panel item.",
.tp_methods = py_panel_item_methods,
.tp_getset = py_panel_item_getseters,
- .tp_new = (newfunc)py_panel_item_new,
- .tp_init = (initproc)pychrysalide_allow_args_for_gobjects
+ //.tp_new = (newfunc)py_panel_item_new,
+ //.tp_init = (initproc)pychrysalide_allow_args_for_gobjects
};
- parent_mod = PyImport_ImportModule("pychrysalide.gui");
- if (parent_mod == NULL) return false;
+ return &py_panel_item_type;
- py_panel_item_type.tp_base = (PyTypeObject *)PyObject_GetAttrString(parent_mod, "EditorItem");
- Py_DECREF(parent_mod);
+}
- if (PyType_Ready(&py_panel_item_type) < 0)
+
+/******************************************************************************
+* *
+* Paramètres : module = module dont la définition est à compléter. *
+* *
+* Description : Prend en charge l'objet 'pychrysalide.gui.panels.PanelItem'. *
+* *
+* Retour : Bilan de l'opération. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool register_python_panel_item(PyObject *module)
+{
+ PyTypeObject *py_panel_item_type; /* Type Python 'LoadedBinary' */
+ int ret; /* Bilan d'un appel */
+ PyObject *dict; /* Dictionnaire du module */
+
+ py_panel_item_type = get_python_panel_item_type();
+
+ py_panel_item_type->tp_base = get_python_editor_item_type();
+ py_panel_item_type->tp_basicsize = py_panel_item_type->tp_base->tp_basicsize;
+
+ if (PyType_Ready(py_panel_item_type) != 0)
return false;
- Py_INCREF(&py_panel_item_type);
- ret = PyModule_AddObject(module, "PanelItem", (PyObject *)&py_panel_item_type);
+ Py_INCREF(py_panel_item_type);
+ ret = PyModule_AddObject(module, "PanelItem", (PyObject *)py_panel_item_type);
+ if (ret != 0) return false;
+
+ dict = PyModule_GetDict(module);
+ pygobject_register_class(dict, "PanelItem", G_TYPE_PANEL_ITEM, py_panel_item_type,
+ Py_BuildValue("(O)", py_panel_item_type->tp_base));
- return (ret == 0);
+ return true;
}