Package muntjac :: Package event :: Module shortcut_listener
[hide private]
[frames] | no frames]

Source Code for Module muntjac.event.shortcut_listener

 1  # Copyright (C) 2012 Vaadin Ltd.  
 2  # Copyright (C) 2012 Richard Lincoln 
 3  #  
 4  # Licensed under the Apache License, Version 2.0 (the "License");  
 5  # you may not use this file except in compliance with the License.  
 6  # You may obtain a copy of the License at  
 7  #  
 8  #     http://www.apache.org/licenses/LICENSE-2.0  
 9  #  
10  # Unless required by applicable law or agreed to in writing, software  
11  # distributed under the License is distributed on an "AS IS" BASIS,  
12  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
13  # See the License for the specific language governing permissions and  
14  # limitations under the License. 
15   
16  from muntjac.event.action import IListener 
17  from muntjac.event.shortcut_action import ShortcutAction 
18   
19   
20 -class ShortcutListener(ShortcutAction, IListener):
21
22 - def __init__(self, *args):
23 24 nargs = len(args) 25 if nargs == 1: 26 shorthandCaption, = args 27 super(ShortcutListener, self).__init__(shorthandCaption) 28 elif nargs == 2: 29 shorthandCaption, modifierKeys = args 30 super(ShortcutListener, self).__init__(shorthandCaption, 31 modifierKeys) 32 elif nargs == 3: 33 caption, keyCode, modifierKeys = args 34 super(ShortcutListener, self).__init__(caption, keyCode, 35 modifierKeys) 36 elif nargs == 4: 37 caption, icon, keyCode, modifierKeys = args 38 super(ShortcutListener, self).__init__(caption, icon, keyCode, 39 modifierKeys) 40 else: 41 raise ValueError
42 43
44 - def handleAction(self, sender, target):
45 pass
46