Package Task :: Package Tools :: Module Base :: Class TaskTools
[hide private]
[frames] | no frames]

Class TaskTools

source code

object --+
         |
        TaskTools


Provides initialize and finalize methods for preparing and unpreparing the
data required by L{Tools} subclasses while a L{Task} or L{Perk} is executing.
Temporarily stores information such as the event layer, event L{POR}, and
timestamp.

@ivar acc_eng: Reference to L{AccessEngine} for task context
@type acc_eng: L{AccessEngine}
@ivar event_man: Reference to the L{EventManager}
@type event_man: L{EventManager}
@ivar view_man: Reference to the L{ViewManager}
@type view_man: L{ViewManager}
@ivar tier_man: Reference to the L{TierManager}
@type tier_man: L{TierManager}
@ivar device_man: Reference to the L{DeviceManager}
@type device_man: L{DeviceManager}
@ivar sett_man: Reference to the L{SettingsManager}
@type sett_man: L{SettingsManager}
@ivar tier: The L{Tier} owning the L{Task} or L{Perk} subclass
@type tier: L{Tier}
@ivar perk: The L{Perk} owning the L{Task} subclass
@type perk: L{Perk}
@ivar layer: Layer on which the event occurred
@type layer: integer
@ivar lsr_state: The state object shared across all L{Tier}s
@type lsr_state: L{AEState.AEState}
@ivar perk_state: The state object shared across all instances of this 
  L{Perk}
@type perk_state: L{AEState.AEState}
@ivar task_por:  The L{POR} for the Task or Perk subclass, set by 
  L{preExecute}
@type task_por: L{POR}
@ivar tools_initialized: Is the instance ready to be executed?
@type tools_initialized: boolean
@ivar tools_auto_pointer: Should the task_por become the pointer after 
  execution?
@type tools_auto_pointer: boolean
@ivar def_out: Default output device to use for all
L{Task.Tools.Output.Output.say}
  calls in this L{Perk} module.
@type def_out: weakref.proxy to L{AEOutput}

Instance Methods [hide private]
 
__init__(self)
Create the ivars and initialize them to None or reasonable defaults.
source code
boolean
preInit(self, ae, tier, perk=None)
Initializes the references to the Perk, Tier, AccessEngine owning this instance of the TaskTools.
source code
 
init(self)
Does nothing.
source code
 
postClose(self)
Frees the references to the Tier, Perk, and AccessEngine as well as all borrowed references from the AccessEngine.
source code
 
close(self)
Does nothing.
source code
boolean
preExecute(self, layer, event_por=None)
Configures this TaskTools object before execution.
source code
 
postExecute(self)
Unconfigures this TaskTools object after execution.
source code
 
_changeDefaultOutput(self, ref=None)
Gets an output device based on the ideal capabilities requested by the current Perk.
source code

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 

Create the ivars and initialize them to None or reasonable defaults.

Overrides: object.__init__

preInit(self, ae, tier, perk=None)

source code 

Initializes the references to the Perk, Tier, AccessEngine owning this instance of the TaskTools. Contacts the AccessEngine to get refs to all managers. These references are fixed throughout the life of the tools object.

Called before state information is loaded from disk.

Parameters:
Returns: boolean
Did the TaskTools initialize (True) or not (False)?

init(self)

source code 

Does nothing. Reserved for subclasses to initialize themselves.

postClose(self)

source code 

Frees the references to the Tier, Perk, and AccessEngine as well as all borrowed references from the AccessEngine. Releases references to state information. Intended to be called after close.

close(self)

source code 

Does nothing. Reserved for subclasses to finalize themselves.

preExecute(self, layer, event_por=None)

source code 

Configures this TaskTools object before execution.

Parameters:
  • layer (integer) - Layer on which the event occurred
  • event_por (POR) - Point of regard received with the event that triggered this execution
Returns: boolean
Is the instance ready for execution?

postExecute(self)

source code 

Unconfigures this TaskTools object after execution. Automatically updates the Tier pointer POR if , the tools_initialized flag is True, the tools_auto_pointer is True, and the event handled is in the focus layer.

_changeDefaultOutput(self, ref=None)

source code 

Gets an output device based on the ideal capabilities requested by the current Perk. Creates a weak proxy for the device object. When the weak ref is no longer valid, this method is called again to find another suitable device.

Parameters:
  • ref (weakref.proxy) - Weak proxy that is no longer valid