just use numberactions that are defined in this actionmap
[enigma2.git] / lib / python / Components / ActionMap.py
1 from enigma import *
2
3 class ActionMap:
4         def __init__(self, contexts = [ ], actions = { }, prio=0):
5                 self.actions = actions
6                 self.contexts = contexts
7                 self.prio = prio
8                 self.p = eActionMapPtr()
9                 eActionMap.getInstance(self.p)
10
11         def execBegin(self):
12                 for ctx in self.contexts:
13                         self.p.bindAction(ctx, self.prio, self.action)
14         
15         def execEnd(self):
16                 for ctx in self.contexts:
17                         self.p.unbindAction(ctx, self.action)
18         
19         def action(self, context, action):
20                 print " ".join(("action -> ", context, action))
21                 if self.actions.has_key(action):
22                         self.actions[action]()
23                         return 1
24                 else:
25                         print "unknown action %s/%s! typo in keymap?" % (context, action)
26                         return 0
27
28                         
29 class NumberActionMap(ActionMap):
30         def action(self, contexts, action):
31                 numbers = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
32                 if (action in numbers and self.actions.has_key(action)):
33                         self.actions[action](int(action))
34                         return 1
35                 else:
36                         return ActionMap.action(self, contexts, action)