Package Task :: Module ScreenTask
[hide private]
[frames] | no frames]

Source Code for Module Task.ScreenTask

  1  ''' 
  2  Defines a L{Task} to execute when some aspective of an accessible's or item's 
  3  appearance on the screen changes. 
  4   
  5  @author: Peter Parente 
  6  @organization: IBM Corporation 
  7  @copyright: Copyright (c) 2005, 2007 IBM Corporation 
  8  @license: The BSD License 
  9   
 10  All rights reserved. This program and the accompanying materials are made  
 11  available under the terms of the BSD license which accompanies 
 12  this distribution, and is available at 
 13  U{http://www.opensource.org/licenses/bsd-license.php} 
 14  ''' 
 15   
 16  import Base, EventTask, AEConstants 
 17  import AEEvent 
 18   
19 -class ScreenTask(EventTask.EventTask):
20 ''' 21 Executed when bounds or visible data changes. 22 23 This class registers its name and whether it should be monitored by default 24 in an L{AEMonitor} using the L{Base.registerTaskType} function 25 when this module is first imported. The L{AEMonitor} can use this 26 information to build its menus. 27 ''' 28 Base.registerTaskType('ScreenTask', False) 29
30 - def getEventType(self):
31 ''' 32 @return: Type of L{AEEvent} this L{Task} wants to handle 33 @rtype: class 34 ''' 35 return AEEvent.ScreenChange
36
37 - def update(self, por, kind, layer, **kwargs):
38 ''' 39 Updates this L{Task} in response to a consumed screen change event. Called 40 by L{Tier.Tier._executeTask}. 41 42 @param por: Point of regard for the related accessible/item 43 @type por: L{POR} 44 @param kind: Indicates the kind of selection event 45 @type kind: integer 46 @param layer: Layer on which the event occurred 47 @type layer: integer 48 ''' 49 pass
50
51 - def execute(self, por, kind, layer, **kwargs):
52 ''' 53 Executes this L{Task} in response to a screen change event. Called by 54 L{Tier.Tier._executeTask}. 55 56 @param por: Point of regard for the related accessible/item 57 @type por: L{POR} 58 @param kind: Indicates the kind of selection event 59 @type kind: integer 60 @param layer: Layer on which the event occurred 61 @type layer: integer 62 @return: True to allow other L{Task}s to process this event 63 @rtype: boolean 64 ''' 65 if kind == AEConstants.SCREEN_OBJECT_BOUNDS: 66 return self.executeResized(por=por, layer=layer, **kwargs) 67 elif kind == AEConstants.SCREEN_TEXT_BOUNDS: 68 return self.executeReflowed(por=por, layer=layer, **kwargs) 69 else: 70 return self.executeRefreshed(por=por, layer=layer, **kwargs)
71
72 - def executeResized(self, por, layer, **kwargs):
73 ''' 74 Executes this L{Task} in response to a change in the bounds of an object. 75 76 @param por: Point of regard for the related accessible/item 77 @type por: L{POR} 78 @param layer: Layer on which the event occurred 79 @type layer: integer 80 @return: True to allow other L{Task}s to process this event 81 @rtype: boolean 82 ''' 83 return True
84
85 - def executeReflowed(self, por, layer, **kwargs):
86 ''' 87 Executes this L{Task} in response to a change in the bounds of a body of 88 text. 89 90 @param por: Point of regard for the related accessible/item 91 @type por: L{POR} 92 @param layer: Layer on which the event occurred 93 @type layer: integer 94 @return: True to allow other L{Task}s to process this event 95 @rtype: boolean 96 ''' 97 return True
98
99 - def executeRefreshed(self, por, layer, **kwargs):
100 ''' 101 Executes this L{Task} in response to a change in the visible data on an 102 object. 103 104 @param por: Point of regard for the related accessible/item 105 @type por: L{POR} 106 @param layer: Layer on which the event occurred 107 @type layer: integer 108 @return: True to allow other L{Task}s to process this event 109 @rtype: boolean 110 ''' 111 return True
112