small fixes (this fixes false positive displaying of unhandledkey symbol)
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>
Sat, 2 Jan 2010 18:15:38 +0000 (18:15 +0000)
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>
Sat, 2 Jan 2010 18:15:38 +0000 (18:15 +0000)
ac3lipsync/src/HelpableNumberActionMap.py
kiddytimer/src/HelpableNumberActionMap.py

index 1020e8e..bad8d03 100644 (file)
@@ -1,9 +1,17 @@
-from Components.ActionMap import NumberActionMap, HelpableActionMap
+from Components.ActionMap import HelpableActionMap
 
-class HelpableNumberActionMap(HelpableActionMap, NumberActionMap):
+class HelpableNumberActionMap(HelpableActionMap):
     """This Actionmap is a HelpableActionMap and a NumberActionMap at the same time.
     It does not have any code, just inherits the init-method from HelpableActionMap and the action from the NumberActionMap"""
     def action(self, contexts, action):
-        NumberActionMap.action(self, contexts, action)
+        numbers = ("0", "1", "2", "3", "4", "5", "6", "7", "8", "9")
+        if (action in numbers and self.actions.has_key(action)):
+            res = self.actions[action](int(action))
+            if res is not None:
+                return res
+            return 1
+        else:
+            return HelpableActionMap.action(self, contexts, action)
+
     def __init__(self, parent, context, actions = { }, prio=0):
-        HelpableActionMap.__init__(self, parent, context, actions, prio)
\ No newline at end of file
+        HelpableActionMap.__init__(self, parent, context, actions, prio)
index 1020e8e..bad8d03 100644 (file)
@@ -1,9 +1,17 @@
-from Components.ActionMap import NumberActionMap, HelpableActionMap
+from Components.ActionMap import HelpableActionMap
 
-class HelpableNumberActionMap(HelpableActionMap, NumberActionMap):
+class HelpableNumberActionMap(HelpableActionMap):
     """This Actionmap is a HelpableActionMap and a NumberActionMap at the same time.
     It does not have any code, just inherits the init-method from HelpableActionMap and the action from the NumberActionMap"""
     def action(self, contexts, action):
-        NumberActionMap.action(self, contexts, action)
+        numbers = ("0", "1", "2", "3", "4", "5", "6", "7", "8", "9")
+        if (action in numbers and self.actions.has_key(action)):
+            res = self.actions[action](int(action))
+            if res is not None:
+                return res
+            return 1
+        else:
+            return HelpableActionMap.action(self, contexts, action)
+
     def __init__(self, parent, context, actions = { }, prio=0):
-        HelpableActionMap.__init__(self, parent, context, actions, prio)
\ No newline at end of file
+        HelpableActionMap.__init__(self, parent, context, actions, prio)