+ if (value)
+ /* CallObject will call __call__ which should return the value tuple */
+ value = PyObject_CallObject(value, 0);
+
+ /* check if this is really a tuple */
+ if (PyTuple_Check(value))
+ {
+ /* convert type to string */
+ PyObject *type = PyTuple_GetItem(value, 0);
+ const char *atype = (type && PyString_Check(type)) ? PyString_AsString(type) : 0;
+
+ if (atype)
+ {
+ if (!strcmp(atype, "text"))
+ {
+ PyObject *pvalue = PyTuple_GetItem(value, 1);
+ const char *value = (pvalue && PyString_Check(pvalue)) ? PyString_AsString(pvalue) : "<not-a-string>";
+ painter.setFont(fnt2);
+ painter.renderText(eRect(offset + eSize(m_seperation, 0), item_right), value, gPainter::RT_HALIGN_RIGHT);
+
+ /* pvalue is borrowed */
+ } else if (!strcmp(atype, "slider"))
+ {
+ PyObject *pvalue = PyTuple_GetItem(value, 1);
+
+ /* convert value to Long. fallback to -1 on error. */
+ int value = (pvalue && PyInt_Check(pvalue)) ? PyInt_AsLong(pvalue) : -1;
+
+ /* calc. slider length */
+ int width = item_right.width() * value / 100;
+ int height = item_right.height();
+
+ /* draw slider */
+ painter.fill(eRect(offset.x() + m_seperation, offset.y(), width, height));
+
+ /* pvalue is borrowed */
+ }
+ }
+ Py_XDECREF(type);
+ }
+ /* value is borrowed */