1 '''
2 Defines a L{Task} to execute when the selector changes.
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, EventTask, AEConstants
16 import AEEvent
17
19 '''
20 Executed when a selector change occurs.
21
22 This class registers its name and whether it should be monitored by default
23 in an L{AEMonitor} using the L{Base.registerTaskType} function when this
24 module is first imported. The L{AEMonitor} can use this information to build
25 its menus.
26 '''
27 Base.registerTaskType('SelectorTask', True)
28
30 '''
31 @return: Type of L{AEEvent} this L{Task} wants to handle
32 @rtype: class
33 '''
34 return AEEvent.SelectorChange
35
36 - def update(self, por, text, layer, kind, **kwargs):
37 '''
38 Update this L{Task} in response to a consumed selector change event. Called
39 by L{Tier.Tier._executeTask}.
40
41 @param text: The accessible text or name of the item at the POR
42 @type text: string
43 @param por: Point of regard for the related accessible
44 @type por: L{POR}
45 @param kind: Indicates the kind of selection event
46 @type kind: integer
47 @param layer: Layer on which the event occurred
48 @type layer: integer
49 '''
50 pass
51
52 - def execute(self, por, text, layer, kind, **kwargs):
53 '''
54 Executes this L{Task} in response to a selector change event. Called by
55 L{Tier.Tier._executeTask}.
56
57 @param text: The accessible text or name of the item at the POR
58 @type text: string
59 @param por: Point of regard for the related accessible
60 @type por: L{POR}
61 @param layer: Layer on which the event occurred
62 @type layer: integer
63 @param kind: Indicates the kind of selection event
64 @type kind: integer
65 @return: Should processing continue? Always returns True by default.
66 @rtype: boolean
67 '''
68 if kind == AEConstants.EVENT_ACTIVE_ITEM_SELECT:
69 return self.executeActive(por=por, text=text, layer=layer, **kwargs)
70 elif kind == AEConstants.EVENT_ADD_ITEM_SELECT:
71 return self.executeAdded(por=por, text=text, layer=layer, **kwargs)
72 elif kind == AEConstants.EVENT_REMOVE_ITEM_SELECT:
73 return self.executeRemoved(por=por, text=text, layer=layer, **kwargs)
74 elif kind == AEConstants.EVENT_CHANGE_TEXT_SELECT:
75 return self.executeText(por=por, text=text, layer=layer, **kwargs)
76
78 '''
79 Executes this L{Task} in response to an active selection change event.
80 Called by L{Tier.Tier._executeTask}.
81
82 @param text: The accessible text or name of the item at the POR
83 @type text: string
84 @param por: Point of regard for the related accessible
85 @type por: L{POR}
86 @param layer: Layer on which the event occurred
87 @type layer: integer
88 @return: Should processing continue? Always returns True by default.
89 @rtype: boolean
90 '''
91 pass
92
93 - def executeText(self, por, text, layer, **kwargs):
94 '''
95 Executes this L{Task} in response to an addition to the current selection.
96 Called by L{Tier.Tier._executeTask}.
97
98 @param text: The accessible text or name of the item at the POR
99 @type text: string
100 @param por: Point of regard for the related accessible
101 @type por: L{POR}
102 @param layer: Layer on which the event occurred
103 @type layer: integer
104 @return: Should processing continue? Always returns True by default.
105 @rtype: boolean
106 '''
107 pass
108
110 '''
111 Executes this L{Task} in response to a removal from the current selection.
112 Called by L{Tier.Tier._executeTask}.
113
114 @param text: The accessible text or name of the item at the POR
115 @type text: string
116 @param por: Point of regard for the related accessible
117 @type por: L{POR}
118 @param layer: Layer on which the event occurred
119 @type layer: integer
120 @return: Should processing continue? Always returns True by default.
121 @rtype: boolean
122 '''
123 pass
124
126 '''
127 Executes this L{Task} in response to a removal from the current selection.
128 Called by L{Tier.Tier._executeTask}.
129
130 @param text: The accessible text or name of the item at the POR
131 @type text: string
132 @param por: Point of regard for the related accessible
133 @type por: L{POR}
134 @param layer: Layer on which the event occurred
135 @type layer: integer
136 @return: Should processing continue? Always returns True by default.
137 @rtype: boolean
138 '''
139 pass
140