summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/pychrysa/gui/panels/panel.c43
-rw-r--r--plugins/python/welcome/panel.py2
2 files changed, 42 insertions, 3 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;
diff --git a/plugins/python/welcome/panel.py b/plugins/python/welcome/panel.py
index 811f008..7b46c57 100644
--- a/plugins/python/welcome/panel.py
+++ b/plugins/python/welcome/panel.py
@@ -19,7 +19,7 @@ class WelcomePanel(PanelItem):
content = self._build_panel_content()
- super(WelcomePanel, self).__init__('Welcome', 'First commands', content, 'M')
+ super(WelcomePanel, self).__init__(PanelItem.PIP_SINGLETON, 'Welcome', 'First commands', content, 'N')
def _build_panel_content(self):