1 from GUIComponent import *
3 from enigma import eListboxPythonMultiContent, eListbox, gFont
5 from Tools.KeyBindings import queryKeyBinding, getKeyDescription
7 # [ ( actionmap, context, [(action, help), (action, help), ...] ), (actionmap, ... ), ... ]
9 class HelpMenuList(GUIComponent):
10 def __init__(self, list, callback):
11 GUIComponent.__init__(self)
13 self.l = eListboxPythonMultiContent()
14 self.callback = callback
17 for (actionmap, context, actions) in list:
18 for (action, help) in actions:
21 entry.append( (actionmap, context, action) )
22 buttons = queryKeyBinding(context, action)
27 name = getKeyDescription(n)
32 buttonstring += ", or "
38 buttonstring = "You can also press " + buttonstring + "."
40 entry.append( (eListboxPythonMultiContent.TYPE_TEXT, 0, 0, 550, 36, 0, 0, help) )
41 entry.append( (eListboxPythonMultiContent.TYPE_TEXT, 0, 40, 550, 20, 1, 0, buttonstring) )
47 self.l.setFont(0, gFont("Regular", 36))
48 self.l.setFont(1, gFont("Regular", 18))
50 def GUIcreate(self, parent):
51 self.instance = eListbox(parent)
52 self.instance.setContent(self.l)
53 self.instance.setItemHeight(75)
56 self.instance.setContent(None)
60 # a list entry has a "private" tuple as first entry...
61 l = self.l.getCurrentSelection()[0]
63 # ...containing (Actionmap, Context, Action).
64 # we returns this tuple to the callback.
65 self.callback(l[0], l[1], l[2])