</screen>
<screen name="HelpMenu" flags="wfNoBorder" position="0,0" size="720,576" title="Menu">
<widget name="list" position="100,100" size="550,375" />
+ <eLabel position="500,40" size="220,60" text="help..." font="Arial;50" />
</screen>
<screen name="MessageBox" position="0,300" size="720,10" title="Message">
<widget name="text" position="0,0" size="650,0" font="Arial;22" />
from keyids import KEYIDS;
+# these are only informational (for help)...
+from Tools.KeyBindings import addKeyBinding
+
def readKeymap():
p = enigma.eActionMapPtr()
# print context + "::" + mapto + " -> " + device + "." + hex(keyid)
p.bindKey(device, keyid, flags, context, mapto)
+ addKeyBinding(keyid, context, mapto)
parseKeys("generic", cmap)
from enigma import eListboxPythonMultiContent, eListbox, gFont
+from Tools.KeyBindings import queryKeyBinding, getKeyDescription
+
# [ ( actionmap, context, [(action, help), (action, help), ...] ), (actionmap, ... ), ... ]
class HelpMenuList(GUIComponent):
l = [ ]
for (actionmap, context, actions) in list:
-
- print "actionmap:" + str(actionmap)
- print "context: " + str(context)
- print "actions: " + str(actions)
-
for (action, help) in actions:
entry = [ ]
entry.append( (actionmap, context, action) )
- entry.append( (0, 36, 200, 20, 1, 0, "you can also press a secret button") )
+ buttons = queryKeyBinding(context, action)
+ buttonstring = ""
+
+ first = True
+ for n in buttons:
+ name = getKeyDescription(n)
+ if name is None:
+ continue
+
+ if not first:
+ buttonstring += ", or "
+
+ first = False
+ buttonstring += name
+
+ if not first:
+ buttonstring = "You can also press " + buttonstring + "."
+
entry.append( (0, 0, 200, 36, 0, 0, help) )
+ entry.append( (0, 40, 200, 20, 1, 0, buttonstring) )
l.append(entry)
def __init__(self):
self.powerKeyTimer = eTimer()
self.powerKeyTimer.timeout.get().append(self.powertimer)
- self["PowerKeyActions"] = ActionMap( ["PowerKeyActions"],
+ self["PowerKeyActions"] = HelpableActionMap(self, "PowerKeyActions",
{
"powerdown": self.powerdown,
"powerup": self.powerup,
+ "discreteStandby": (self.standby, "Go standby"),
+ "discretePowerOff": (self.quit, "Go to deep standby"),
})
def powertimer(self):
self.powerKeyTimer.stop()
if self.standbyblocked == 0:
self.standbyblocked = 1
- self.session.open(Standby, self)
+ self.standby()
+
+ def standby(self):
+ self.session.open(Standby, self)
def quit(self):
- quitMainloop(0)
+ # halt
+ quitMainloop(1)
class InfoBarNumberZap:
""" Handles an initial number for NumberZapping """
class InfoBarMenu:
""" Handles a menu action, to open the (main) menu """
def __init__(self):
- self["MenuActions"] = ActionMap( [ "InfobarMenuActions" ],
+ self["MenuActions"] = HelpableActionMap(self, "InfobarMenuActions",
{
- "mainMenu": self.mainMenu,
+ "mainMenu": (self.mainMenu, "Enter main menu..."),
})
def mainMenu(self):
class InfoBarPVR:
"""handles PVR specific actions like seeking, pause"""
def __init__(self):
- self["PVRActions"] = ActionMap( [ "InfobarPVRActions" ],
+ self["PVRActions"] = HelpableActionMap(self, "InfobarPVRActions",
{
- "pauseService": self.pauseService,
- "unPauseService": self.unPauseService,
+ "pauseService": (self.pauseService, "pause"),
+ "unPauseService": (self.unPauseService, "continue"),
- "seekFwd": self.seekFwd,
- "seekBack": self.seekBack,
+ "seekFwd": (self.seekFwd, "skip forward"),
+ "seekBack": (self.seekBack, "skip backward"),
})
def pauseService(self):
"""Instant Record - handles the instantRecord action in order to
start/stop instant records"""
def __init__(self):
- self["InstnantRecordActions"] = ActionMap( [ "InfobarInstantRecord" ],
+ self["InstnantRecordActions"] = HelpableActionMap(self, "InfobarInstantRecord",
{
- "instantRecord": self.instantRecord,
+ "instantRecord": (self.instantRecord, "Instant Record..."),
})
self.recording = None
class InfoBarAudioSelection:
def __init__(self):
- self["AudioSelectionAction"] = ActionMap( [ "InfobarAudioSelectionActions" ],
+ self["AudioSelectionAction"] = HelpableActionMap(self, "InfobarAudioSelectionActions",
{
- "audioSelection": self.audioSelection,
+ "audioSelection": (self.audioSelection, "Audio Options..."),
})
def audioSelection(self):
--- /dev/null
+
+keyBindings = { }
+
+def addKeyBinding(key, context, action):
+ if (context, action) in keyBindings:
+ keyBindings[(context, action)].append(key)
+ else:
+ keyBindings[(context, action)] = [key]
+
+def queryKeyBinding(context, action):
+ if (context, action) in keyBindings:
+ return keyBindings[(context, action)]
+ else:
+ return [ ]
+
+def getKeyDescription(key):
+ return "key_%0x" % key
-all = ["FuzzyDate.py", "XMLTools.py", "Directories.py"]
+all = ["FuzzyDate.py", "XMLTools.py", "Directories.py", "KeyBindings.py"]