1 from GUIComponent import *
3 from enigma import eListboxPythonMultiContent, eListbox, gFont
5 from Tools.KeyBindings import queryKeyBinding, getKeyDescription
8 # [ ( actionmap, context, [(action, help), (action, help), ...] ), (actionmap, ... ), ... ]
10 class HelpMenuList(GUIComponent):
11 def __init__(self, list, callback):
12 GUIComponent.__init__(self)
13 self.onSelChanged = [ ]
14 self.l = eListboxPythonMultiContent()
15 self.callback = callback
18 for (actionmap, context, actions) in list:
19 for (action, help) in actions:
22 buttons = queryKeyBinding(context, action)
27 name = getKeyDescription(n)
31 entry.append( (actionmap, context, action, name ) )
32 entry.append( (eListboxPythonMultiContent.TYPE_TEXT, 0, 0, 400, 28, 0, 0, help) )
38 self.l.setFont(0, gFont("Regular", 26))
41 # a list entry has a "private" tuple as first entry...
42 l = self.l.getCurrentSelection()[0]
44 # ...containing (Actionmap, Context, Action, keydata).
45 # we returns this tuple to the callback.
46 self.callback(l[0], l[1], l[2])
49 return self.l.getCurrentSelection()[0]
51 def GUIcreate(self, parent):
52 self.instance = eListbox(parent)
53 self.instance.setContent(self.l)
54 self.instance.setItemHeight(42)
55 self.instance.selectionChanged.get().append(self.selectionChanged)
58 self.instance.setContent(None)
59 self.instance.selectionChanged.get().remove(self.selectionChanged)
62 def selectionChanged(self):
63 for x in self.onSelChanged: