<key id="KEY_END" mapto="moveEnd" flags="mr" />
<key id="KEY_PAGEUP" mapto="pageUp" flags="mr" />
<key id="KEY_PAGEDOWN" mapto="pageDown" flags="mr" />
+ <key id="KEY_LEFT" mapto="pageUp" flags="mr" />
+ <key id="KEY_RIGHT" mapto="pageDown" flags="mr" />
<key id="1" mapto="moveUp" flags="mr" />
<key id="2" mapto="moveDown" flags="mr" />
</map>
<key id="KEY_C" mapto="contextMenu" flags="m" />
<key id="KEY_M" mapto="mark" flags="m" />
<!-- yes, this is flexible as hell. -->
- <key id="KEY_P" mapto="bouquet:(provider == PREMIERE)" flags="m" />
+ <key id="KEY_RED" mapto="bouquet:(provider == PREMIERE)" flags="m" />
<key id="KEY_D" mapto="bouquet:(provider == ARD)" flags="m" />
<key id="KEY_A" mapto="bouquet:" flags="m" />
+ <key id="KEY_BLUE" mapto="showFavourites" flags="m" />
</map>
<map context="OkCancelActions">
<key id="\x0a" mapto="ok" flags="m" />
from enigma import *
class ServiceList(HTMLComponent, GUIComponent):
+
+ MODE_NORMAL = 0
+ MODE_FAVOURITES = 1
+
def __init__(self):
GUIComponent.__init__(self)
self.l = eListboxServiceContent()
ref = eServiceReference()
return marked
+
+ def setMode(self, mode):
+ if mode == self.MODE_NORMAL:
+ self.instance.setItemHeight(20)
+ self.l.setVisualMode(eListboxServiceContent.visModeSimple)
+ else:
+ self.instance.setItemHeight(40)
+
+ self.l.setElementFont(self.l.celServiceName, gFont("Arial", 30))
+ self.l.setElementPosition(self.l.celServiceName, eRect(40, 0, self.instance.size().width(), 40))
+ self.l.setElementFont(self.l.celServiceNumber, gFont("Arial", 20))
+ self.l.setElementPosition(self.l.celServiceNumber, eRect(0, 10, 40, 30))
+
+ self.l.setVisualMode(eListboxServiceContent.visModeComplex)
def action(self, contexts, action):
if action[:7] == "bouquet":
print "setting root to " + action[8:]
- self.csel["list"].setRoot(eServiceReference("1:0:1:0:0:0:0:0:0:0:" + action[8:]))
+ l = self.csel["list"]
+ l.setMode(l.MODE_NORMAL)
+ l.setRoot(eServiceReference("1:0:1:0:0:0:0:0:0:0:" + action[8:]))
else:
ActionMap.action(self, contexts, action)
"cancel": self.close,
"ok": self.channelSelected,
"mark": self.doMark,
- "contextMenu": self.doContext
+ "contextMenu": self.doContext,
+ "showFavourites": self.showFavourites
})
self["actions"].csel = self
# ...
def channelSelected(self):
self.session.nav.playService(self["list"].getCurrent())
+ print "current: " + self["list"].getCurrent().toString()
self.close()
#called from infoBar
def setMoveMode(self, mode):
self.movemode = mode
+ def showFavourites(self):
+ l = self["list" ]
+ l.setRoot(eServiceReference('1:0:1:0:0:0:0:0:0:0:(provider == "fav")'))
+ l.setMode(l.MODE_FAVOURITES)
from Components.Button import Button
from Components.ServiceName import ServiceName
from Components.EventInfo import EventInfo
+from Components.ServicePosition import ServicePosition
from Screens.MessageBox import MessageBox
from Screens.MovieSelection import MovieSelection
})
# self["okbutton"] = Button("mainMenu", [self.mainMenu])
- self["CurrentTime"] = Clock()
+ self["CurrentTime"] = ServicePosition(self.session.nav, ServicePosition.TYPE_REMAINING)
+ # Clock()
self["Volume"] = self.volumeBar
return index;
}
+void eListboxServiceContent::setVisualMode(int mode)
+{
+ m_visual_mode = mode;
+
+ if (m_visual_mode == visModeSimple)
+ {
+ m_element_position[celServiceName] = eRect(ePoint(0, 0), m_itemsize);
+ m_element_font[celServiceName] = new gFont("Arial", 14);
+ m_element_position[celServiceNumber] = eRect();
+ m_element_font[celServiceNumber] = 0;
+ m_element_position[celIcon] = eRect();
+ m_element_position[celServiceInfo] = eRect();
+ m_element_font[celServiceInfo] = 0;
+ }
+}
+
+void eListboxServiceContent::setElementPosition(int element, eRect where)
+{
+ if ((element >= 0) && (element < celElements))
+ m_element_position[element] = where;
+}
+
+void eListboxServiceContent::setElementFont(int element, gFont *font)
+{
+ if ((element >= 0) && (element < celElements))
+ m_element_font[element] = font;
+}
+
DEFINE_REF(eListboxServiceContent);
eListboxServiceContent::eListboxServiceContent()
{
+ m_visual_mode = visModeSimple;
m_size = 0;
cursorHome();
eServiceCenter::getInstance(m_service_center);
void eListboxServiceContent::setSize(const eSize &size)
{
m_itemsize = size;
+ setVisualMode(m_visual_mode);
}
void eListboxServiceContent::paint(gPainter &painter, eWindowStyle &style, const ePoint &offset, int selected)
{
- ePtr<gFont> fnt = new gFont("Arial", 14);
painter.clip(eRect(offset, m_itemsize));
if (cursorValid() && isMarked(*m_cursor))
style.setStyle(painter, eWindowStyle::styleListboxMarked);
if (cursorValid())
{
- painter.setFont(fnt);
-
- ePoint text_offset = offset + (selected ? ePoint(2, 2) : ePoint(1, 1));
-
- /* get name of service */
+ /* get service information */
ePtr<iStaticServiceInformation> service_info;
m_service_center->info(*m_cursor, service_info);
- std::string name = "<n/a>";
-
- if (service_info)
- service_info->getName(*m_cursor, name);
- painter.renderText(eRect(text_offset, m_itemsize), name);
+ for (int e = 0; e < celElements; ++e)
+ {
+ if (!m_element_font[e])
+ continue;
+ painter.setFont(m_element_font[e]);
+
+ std::string text = "<n/a>";
+
+ switch (e)
+ {
+ case celServiceName:
+ {
+ if (service_info)
+ service_info->getName(*m_cursor, text);
+ break;
+ }
+ case celServiceNumber:
+ {
+ char bla[10];
+ sprintf(bla, "%d", m_cursor_number + 1);
+ text = bla;
+ break;
+ }
+ case celServiceInfo:
+ {
+ text = "now&next";
+ break;
+ }
+ case celIcon:
+ continue;
+ }
+
+ eRect area = m_element_position[e];
+ area.moveBy(offset.x(), offset.y());
+
+ painter.renderText(area, text);
+ }
if (selected)
style.drawFrame(painter, eRect(offset, m_itemsize), eWindowStyle::frameListboxEntry);
int lookupService(const eServiceReference &ref);
+ enum {
+ visModeSimple,
+ visModeComplex
+ };
+
+ void setVisualMode(int mode);
+
+ /* only in complex mode: */
+ enum {
+ celServiceName,
+ celServiceNumber,
+ celIcon,
+ celServiceInfo, // "now" event
+ celElements
+ };
+
+ void setElementPosition(int element, eRect where);
+ void setElementFont(int element, gFont *font);
+
protected:
void cursorHome();
void cursorEnd();
/* the following functions always refer to the selected item */
void paint(gPainter &painter, eWindowStyle &style, const ePoint &offset, int selected);
+
+ int m_visual_mode;
+ /* for complex mode */
+ eRect m_element_position[celElements];
+ ePtr<gFont> m_element_font[celElements];
private:
typedef std::list<eServiceReference> list;
<!-- <eLabel position="70,0" size="300,30" text=".oO skin Oo." font="Arial;20" /> -->
</screen>
<screen name="ChannelSelection" position="90,100" size="560,420" title="Channel Selection">
- <widget name="list" position="0,50" size="560,340" />
+ <widget name="list" position="0,50" size="560,320" />
<!-- <widget name="okbutton" position="340,50" size="140,30" />-->
<widget name="key_red" position="0,0" size="140,40" backgroundColor="red" />
<widget name="key_green" position="140,0" size="140,40" backgroundColor="green" />