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)
28 (name, flags) = (getKeyDescription(n[0]), n[1])
32 if flags & 8: # for long keypresses, prepend l_ into the key name.
33 name = ("l_" + name[0], name[1], name[2])
35 entry.append( (actionmap, context, action, name ) )
36 entry.append( (eListboxPythonMultiContent.TYPE_TEXT, 0, 0, 400, 28, 0, 0, help) )
42 self.l.setFont(0, gFont("Regular", 26))
43 self.l.setItemHeight(42)
46 # a list entry has a "private" tuple as first entry...
50 # ...containing (Actionmap, Context, Action, keydata).
51 # we returns this tuple to the callback.
52 self.callback(l[0], l[1], l[2])
55 sel = self.l.getCurrentSelection()
60 def postWidgetCreate(self, instance):
61 instance.setContent(self.l)
63 instance.selectionChanged.get().append(self.selectionChanged)
65 def selectionChanged(self):
66 for x in self.onSelChanged: