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

Source Code for Module Task.PropertyTask

 1  ''' 
 2  Defines a L{Task} to execute when a text or numeric property changes. 
 3   
 4  @author: Peter Parente 
 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   
18 -class PropertyTask(EventTask.EventTask):
19 ''' 20 Executed when a text or numeric property 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('PropertyTask', False) 28
29 - def getEventType(self):
30 ''' 31 @return: Type of L{AEEvent} this L{Task} wants to handle 32 @rtype: class 33 ''' 34 return AEEvent.PropertyChange
35
36 - def update(self, por, name, value, layer, **kwargs):
37 ''' 38 Updates this L{Task} in response to a consumed property change event. Called 39 by L{Tier.Tier._executeTask}. 40 41 @param por: Point of regard for the related accessible 42 @type por: L{POR} 43 @param name: Name of the property that changed 44 @type name: string 45 @param value: New value of the property 46 @type value: string or number 47 @param layer: Layer on which the event occurred 48 @type layer: integer 49 ''' 50 pass
51
52 - def execute(self, por, name, value, layer, **kwargs):
53 ''' 54 Executes this L{Task} in response to a property change event. Called by 55 L{Tier.Tier._executeTask}. 56 57 @param por: Point of regard for the related accessible 58 @type por: L{POR} 59 @param name: Name of the property that changed 60 @type name: string 61 @param value: New value of the property 62 @type value: string or number 63 @param layer: Layer on which the event occurred 64 @type layer: integer 65 @return: True to allow other L{Task}s to process this event 66 @rtype: boolean 67 ''' 68 return True
69