1 '''
2 Defines an L{AEEvent} indicating the view has been updated by the
3 L{AEViewManager}.
4
5 @author: Peter Parente
6 @author: Pete Brunet
7 @organization: IBM Corporation
8 @copyright: Copyright (c) 2005, 2007 IBM Corporation
9 @license: The BSD License
10
11 @author: Frank Zenker
12 @author: Ramona Bunk
13 @organization: IT Science Center Ruegen gGmbH, Germany
14 @copyright: Copyright (c) 2007, 2008 ITSC Ruegen
15 @license: The BSD License
16
17 All rights reserved. This program and the accompanying materials are made
18 available under the terms of the BSD license which accompanies
19 this distribution, and is available at
20 U{http://www.opensource.org/licenses/bsd-license.php}
21 '''
22
23 import AccessEngine
24 import Base
25 from AccessEngine import AEConstants
26 from AccessEngine.AEAccInterfaces import *
27
29 '''
30 Event that fires when the L{AEViewManager} is creating or updating its view.
31
32 This class registers its name and whether it should be monitored by default
33 in an L{AEMonitor} using the L{Base.registerEventType} function when
34 this module is first imported. An L{AEMonitor} can use this information to
35 build its menus.
36
37 @ivar gained: Type of view change
38 @type gained: boolean
39 @ivar title: Name of the root element of the new view (e.g. title of the
40 foreground window)
41 @type title: string
42 '''
43 Base.registerEventType('ViewChange', True)
44 - def __init__(self, por, gained, **kwargs):
45 '''
46 Stores the type of view change and intializes the title attribute to
47 an empty string.
48
49 @param por: Point-of-regard to the accessible at the root of the new view
50 @type por: L{AEPor <AEPor.AEPor>}
51 @param gained: Type of view change
52 @type gained: integer
53 '''
54 focused = gained in (AEConstants.EVENT_VIEW_GAINED,
55 AEConstants.EVENT_VIEW_FIRST_GAINED)
56 Base.AEEvent.__init__(self, focused=focused, **kwargs)
57 self.por = por
58 self.gained = gained
59 self.title = ''
60
80
120
122 '''
123 Fetches data out of this L{ViewChange} for use by a
124 L{AEScript.EventScript.onViewChange}-Task.
125
126 @return: Dictionary of parameters to be passed to a
127 L{AEScript.EventScript.onViewChange}-Task as follows:
128 - por: Point of regard to the top of the new view
129 - title: String containing the window title of the view which changed
130 - gained: The type of view change, indicated by one of the integer
131 class variables
132 @rtype: dictionary
133 '''
134 return {'title':self.title, 'gained':self.gained, 'por':self.getPOR()}
135