Package AEEvent :: Module PrivateChange
[hide private]
[frames] | no frames]

Source Code for Module AEEvent.PrivateChange

 1  ''' 
 2  Defines an L{AEEvent} encapsulating arbitrary private data intended to be 
 3  consumed by the L{TierManager} or L{Tier}, but not passed on to L{Perk}s or 
 4  L{Task}s. 
 5   
 6  @author: Peter Parente 
 7  @organization: IBM Corporation 
 8  @copyright: Copyright (c) 2005, 2007 IBM Corporation 
 9  @license: The BSD License 
10   
11  All rights reserved. This program and the accompanying materials are made  
12  available under the terms of the BSD license which accompanies 
13  this distribution, and is available at 
14  U{http://www.opensource.org/licenses/bsd-license.php} 
15  ''' 
16   
17  import Base 
18   
19 -class PrivateChange(Base.AccessEngineEvent):
20 ''' 21 Event that fires when some change occurs. 22 23 @ivar kind: Kind of chage, one of class variables in this class 24 @type kind: integer 25 @ivar kwargs: Aribitrary data to be provided with the event 26 @type kwargs: dictionary 27 ''' 28 KEY_PRESS = 0 29
30 - def __init__(self, kind, **kwargs):
31 ''' 32 Calls the base class and stores the kind and data. 33 34 @param kind: Kind of chage, one of class variables in this class 35 @type kind: integer 36 @param kwargs: Aribitrary data to be provided with the event 37 @type kwargs: dictionary 38 ''' 39 Base.AccessEngineEvent.__init__(self, focused=True, **kwargs) 40 self.kind = kind 41 self.kwargs = kwargs
42
43 - def execute(self, tier_manager, **kwargs):
44 ''' 45 Contacts the L{TierManager} so it can manage the private event. 46 47 @param tier_manager: TierManager that will handle the event 48 @type tier_manager: L{TierManager} 49 @param kwargs: Packed references to other managers not of interest here 50 @type kwargs: dictionary 51 @return: Always True to indicate the event executed properly 52 @rtype: boolean 53 ''' 54 tier_manager.managePrivate(self) 55 return True
56
57 - def getDataForTask(self):
58 ''' 59 Fetches data out of this L{PrivateChange} for use by the L{TierManager} 60 or a L{Tier}. 61 62 @return: Dictionary of parameters to be passed to a L{Task.MouseTask} as 63 follows: 64 - kind: The kind of event 65 - any additional data in the L{kwargs} instance variable 66 @rtype: dictionary 67 ''' 68 d = {} 69 d.update(self.kwargs) 70 d['kind'] = self.kind 71 return d
72