Module SueScript
[hide private]
[frames] | no frames]

Source Code for Module SueScript

 1  ''' 
 2  General SUE script. 
 3   
 4  @author: Ramona Bunk 
 5  @organization: IT Science Center Ruegen gGmbH, Germany 
 6  @copyright: Copyright (c) 2007, 2008 ITSC Ruegen 
 7   
 8  @license: I{The BSD License} 
 9  All rights reserved. This program and the accompanying materials are made  
10  available under the terms of the BSD license which accompanies 
11  this distribution, and is available at 
12  U{http://www.opensource.org/licenses/bsd-license.php} 
13  ''' 
14  # import useful modules for Scripts 
15  import AccessEngine 
16  from AccessEngine import AEScript, AccessEngineAPI 
17  from AccessEngine import AEConstants 
18  #from AccessEngine.AEPor import AEPor 
19  from Tools.i18n import bind, _ 
20   
21  # metadata describing this Script 
22  __uie__ = dict(kind='script', tier=None, all_tiers=True) 
23   
24  # to support translation of strings in this Script, uncomment the following line 
25  # and provide the proper domain and path to your translation file 
26  # _ = bind(domain, locale_dir) 
27   
28 -class SueScript(AEScript.EventScript):
29 ''' 30 This script contains functionallity, that fits in no other script. 31 '''
32 - def init(self):
33 ''' 34 To register general tasks. 35 ''' 36 self.registerTask('quit sue', self.quit) 37 38 # get the Keyboard device and register modifiers and commands 39 kbd = AccessEngineAPI.getInputDevice(None, 'keyboard') 40 AccessEngineAPI.addInputModifiers(self, kbd, kbd.AEK_ALT_L, 41 kbd.AEK_SHIFT_L, kbd.AEK_ALT_R, 42 kbd.AEK_SHIFT_R, kbd.AEK_CAPS_LOCK) 43 pairs = [[kbd.AEK_ALT_L, kbd.AEK_SHIFT_L], [kbd.AEK_ALT_R, kbd.AEK_SHIFT_R]] 44 45 # register input commands 46 for pair in pairs: 47 self.registerCommand(kbd, 'quit sue', 48 _('quit sue'), False, pair+[kbd.AEK_Q])
49
50 - def quit(self, **kwargs):
51 ''' 52 This task prompts the L{AccessEngine} to quit sue. 53 ''' 54 AccessEngine.AEMain.quit()
55