From 66795123ebff2381a76b60a3bc81ee55c51ff6fd Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Wed, 12 Oct 2005 00:49:04 +0000 Subject: add NumberActionMap for better input of numbers --- lib/python/Components/ActionMap.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lib/python/Components') diff --git a/lib/python/Components/ActionMap.py b/lib/python/Components/ActionMap.py index 0ff5098b..cd466c14 100644 --- a/lib/python/Components/ActionMap.py +++ b/lib/python/Components/ActionMap.py @@ -24,3 +24,13 @@ class ActionMap: else: print "unknown action %s/%s! typo in keymap?" % (context, action) return 0 + + +class NumberActionMap(ActionMap): + def action(self, contexts, action): + numbers = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] + if (action in numbers): + self.actions[action](int(action)) + return 1 + else: + return ActionMap.action(self, contexts, action) \ No newline at end of file -- cgit v1.2.3