goto error_out;
}
- PyObject *px = 0, *py = 0, *pwidth = 0, *pheight = 0, *pfnt = 0, *pstring = 0, *pflags = 0;
+ PyObject *px = 0, *py = 0, *pwidth = 0, *pheight = 0, *pfnt = 0, *pstring = 0, *pflags = 0, *pcolor = 0;
/*
we have a list of tuples:
- (0, x, y, width, height, fnt, flags, "bla" ),
+ (0, x, y, width, height, fnt, flags, "bla"[, color] ),
or, for a progress:
(1, x, y, width, height, filled_percent )
pflags = PyTuple_GET_ITEM(item, 6);
pstring = PyTuple_GET_ITEM(item, 7);
}
+ if (size > 8)
+ pcolor = PyTuple_GET_ITEM(item, 8);
}
switch (type)
{
if (!(px && py && pwidth && pheight && pfnt && pstring))
{
- eDebug("eListboxPythonMultiContent received too small tuple (must be (TYPE_TEXT, x, y, width, height, fnt, flags, string[, ...])");
+ eDebug("eListboxPythonMultiContent received too small tuple (must be (TYPE_TEXT, x, y, width, height, fnt, flags, string, [color, ]...])");
goto error_out;
}
int flags = PyInt_AsLong(pflags);
int fnt = PyInt_AsLong(pfnt);
+ if (pcolor)
+ {
+ int color = PyInt_AsLong(pcolor);
+ painter.setForegroundColor(gRGB(color));
+ }
+
if (m_font.find(fnt) == m_font.end())
{
eDebug("eListboxPythonMultiContent: specified font %d was not found!", fnt);
eWarning("eListboxPythonMultiContent received unknown type (%d)", type);
goto error_out;
}
+
+ if (pcolor)
+ style.setStyle(painter, selected ? eWindowStyle::styleListboxSelected : eWindowStyle::styleListboxNormal);
}
}
int eListboxPythonMultiContent::currentCursorSelectable()
{
- return eListboxPythonStringContent::currentCursorSelectable();
+ if (m_list && cursorValid())
+ {
+ PyObject *item = PyList_GET_ITEM(m_list, m_cursor);
+
+ if (PyList_Check(item))
+ {
+ item = PyList_GET_ITEM(item, 0);
+ if (PyTuple_Check(item))
+ {
+ item = PyTuple_GET_ITEM(item, 0);
+ if (item != Py_None)
+ return 1;
+ }
+ }
+ }
+ return 0;
}
void eListboxPythonMultiContent::setFont(int fnt, gFont *font)
from enigma import eListboxPythonMultiContent
-def MultiContentEntryText(pos = (0, 0), size = (0, 0), font = 0, flags = RT_HALIGN_LEFT | RT_VALIGN_TOP, text = ""):
- return (eListboxPythonMultiContent.TYPE_TEXT, pos[0], pos[1], size[0], size[1], font, flags, text)
+def MultiContentEntryText(pos = (0, 0), size = (0, 0), font = 0, flags = RT_HALIGN_LEFT | RT_VALIGN_TOP, text = "", color = None):
+ add = ()
+ if color is not None:
+ add = (color, )
+ return (eListboxPythonMultiContent.TYPE_TEXT, pos[0], pos[1], size[0], size[1], font, flags, text) + add
def MultiContentEntryPixmap(pos = (0, 0), size = (0, 0), png = None):
return (eListboxPythonMultiContent.TYPE_PIXMAP, pos[0], pos[1], size[0], size[1], png)