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 @author: Frank Zenker
10 @author: Ramona Bunk
11 @organization: IT Science Center Ruegen gGmbH, Germany
12 @copyright: Copyright (c) 2007, 2008 ITSC Ruegen
13 @license: The BSD License
14
15 All rights reserved. This program and the accompanying materials are made
16 available under the terms of the BSD license which accompanies
17 this distribution, and is available at
18 U{http://www.opensource.org/licenses/bsd-license.php}
19 '''
20
21 import AccessEngine
22 import Base
23
25 '''
26 Event that fires when some aspect of screen bounds or visible data changes.
27
28 This class registers its name and whether it should be monitored by default in
29 an L{AEMonitor} using the L{Base.registerEventType} function
30 when this module is first imported. The L{AEMonitor} can use this
31 information to build its menus.
32
33 @ivar kind: One of the integer class variables in this class
34 @type kind: integer
35 '''
36 Base.registerEventType('ScreenChange', False)
37 - def __init__(self, por, kind, **kwargs):
38 '''
39 Calls the base class and stores L{AEPor <AEPor.AEPor>} and type of event.
40
41 @param por: Point of regard to an object that changed on screen
42 @type por: L{AEPor <AEPor.AEPor>}
43 @param kind: Kind of screen change event
44 @type kind: integer
45 '''
46 Base.AEEvent.__init__(self, **kwargs)
47 self.por = por
48 self.kind = kind
49
51 '''
52 Returns a human readable representation of this event including its name,
53 its L{AEPor <AEPor.AEPor>}, and its kind.
54
55 @return: Information about this event
56 @rtype: string
57 '''
58 name = Base.AEEvent.__str__(self)
59 if self.kind == AEConstants.EVENT_OBJECT_BOUNDS:
60 action = 'object bounds'
61 elif self.kind == AEConstants.EVENT_TEXT_BOUNDS:
62 action = 'text bounds'
63 else:
64 action = 'visible data'
65 return '%s:\n\tPOR: %s\n\taction: %s' % \
66 (name, self.por, action)
67
69 '''
70 Contacts the L{AETierManager} so it can manage the screen change event.
71
72 @return: Always True to indicate the event executed properly
73 @rtype: boolean
74 '''
75 AccessEngine.AETierManager.manageEvent(self)
76 return True
77
79 '''
80 Fetches data out of this L{ScreenChange} for use by a
81 L{AEScript.EventScript.onScreenChange}-Task.
82
83 @return: Dictionary of parameters to be passed to a
84 L{AEScript.EventScript.onScreenChange}-Task as follows:
85 - por: The L{AEPor <AEPor.AEPor>} pointing at the item at which
86 selection changed or the current caret location for a text
87 selection change
88 - kind: The kind of screen change
89 @rtype: dictionary
90 '''
91 return {'por' : self.getPOR(), 'kind' : self.kind}
92