1 '''
2 Defines an L{AEEvent} indicating that the selector has moved.
3
4 @author: Pete Brunet
5 @organization: IBM Corporation
6 @copyright: Copyright (c) 2005, 2007 IBM Corporation
7 @license: The BSD License
8
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
15 import Base
16
18 '''
19 Event that fires when some aspect of screen bounds or visible data changes.
20
21 This class registers its name and whether it should be monitored by default in
22 an L{AEMonitor} using the L{Base.registerEventType} function
23 when this module is first imported. The L{AEMonitor} can use this
24 information to build its menus.
25
26 @ivar kind: One of the integer class variables in this class
27 @type kind: integer
28 '''
29 Base.registerEventType('ScreenChange', False)
30 - def __init__(self, por, kind, **kwargs):
31 '''
32 Calls the base class and stores L{POR} and type of event.
33
34 @param por: Point of regard to an object that changed on screen
35 @type por: L{POR}
36 @param kind: Kind of screen change event
37 @type kind: integer
38 '''
39 Base.AccessEngineEvent.__init__(self, **kwargs)
40 self.por = por
41 self.kind = kind
42
44 '''
45 Returns a human readable representation of this event including its name,
46 its L{POR}, and its kind.
47
48 @return: Information about this event
49 @rtype: string
50 '''
51 name = Base.AccessEngineEvent.__str__(self)
52 if self.kind == AEConstants.EVENT_OBJECT_BOUNDS:
53 action = 'object bounds'
54 elif self.kind == AEConstants.EVENT_TEXT_BOUNDS:
55 action = 'text bounds'
56 else:
57 action = 'visible data'
58 return '%s:\n\tPOR: %s\n\taction: %s' % \
59 (name, self.por, action)
60
61 - def execute(self, tier_manager, **kwargs):
62 '''
63 Contacts the L{TierManager} so it can manage the screen change event.
64
65 @param tier_manager: TierManager that will handle the event
66 @type tier_manager: L{TierManager}
67 @param kwargs: Packed references to other managers not of interest here
68 @type kwargs: dictionary
69 @return: Always True to indicate the event executed properly
70 @rtype: boolean
71 '''
72 tier_manager.manageEvent(self)
73 return True
74
76 '''
77 Fetches data out of this L{ScreenChange} for use by a L{Task.ScreenTask}.
78
79 @return: Dictionary of parameters to be passed to a
80 L{Task.ScreenTask} as follows:
81 - por: The L{POR} pointing at the item at which selection changed or
82 the current caret location for a text selection change
83 - kind: The kind of screen change
84 @rtype: dictionary
85 '''
86 return {'por' : self.getPOR(), 'kind' : self.kind}
87