Package schrodinger :: Package tasks :: Module mappers :: Class AbstractParamMapper
[hide private]
[frames] | no frames]

Class AbstractParamMapper

object --+
         |
        AbstractParamMapper
Known Subclasses:

Instance Methods [hide private]
 
suspend_auto_update_target(*args, **kwds)
A param mapper manages synchronization between a model object with params and target objects that represent each param.
 
__init__(self, auto_update_target=False)
x.__init__(...) initializes x; see help(type(x)) for signature
 
addMapping(self, param, mapped_obj)
Maps an abstract param to a target object.
 
setModelInstance(self, model)
Sets the model instance to map.
 
onModelParamsChanged(self)
 
_getMappedValue(self, mapped_obj)
This virtual method should return a mapped object's value, however that is defined by the derived class.
 
_setMappedValue(self, mapped_obj, value)
This virtual method should set a mapped object's value, however that is defined by the derived class.
 
_updateModelParam(self, param)
Updates the param value on the model object from the mapped object.
 
_updateTargetParam(self, param)
Updates the mapped object from the param value on the model object.
 
updateModel(self)
Updates all mapped parameters on the model object from the target objects.
 
updateTarget(self)
Updates all target objects from the mapped parameters on the model object.

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

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, auto_update_target=False)
(Constructor)

 

x.__init__(...) initializes x; see help(type(x)) for signature

Parameters:
  • auto_update_target (bool) - whether target objects should be updated immediately whenever the correpsonding parameter is changed. This option only works if the model object emits paramsChanged signal whenever any of the params changes. This facility is built in to the base class parameters.ParamContainer.
Overrides: object.__init__

addMapping(self, param, mapped_obj)

 

Maps an abstract param to a target object. An abstract param is a param
that is owned at the top level by the model's class rather than an
instance of the model. This allows the same mapping to be used on
multiple model instances.

The details of the target object are left to derived mapper classes.

Notes:
    If a param is already mapped to a target, the old mapping will be
    replaced by the new one.

    A param may be mapped to only one target. However, multple params
    may be mapped to the same target. This is useful when the same
    target (ex. a widget in a panel) is reused for multiple tasks.

@param param: the abstract param (ex. Atom.coord.x)
@type param: parameters.AbstractParam

@param mapped_obj: the target object that the param maps to

setModelInstance(self, model)

 

Sets the model instance to map. This should be an instance of the model class that is being used in addMapping().

Parameters:
  • model (object) - the model instance

onModelParamsChanged(self)

 
Decorators:
  • @util.skip_if('auto_update_target', False)

_getMappedValue(self, mapped_obj)

 

This virtual method should return a mapped object's value, however that is defined by the derived class.

Parameters:
  • mapped_obj - the target object

_setMappedValue(self, mapped_obj, value)

 

This virtual method should set a mapped object's value, however that is defined by the derived class.

Parameters:
  • mapped_obj - the target object

_updateModelParam(self, param)

 

Updates the param value on the model object from the mapped object.

Parameters:
  • param (parameters.AbstractParam) - the abstract param that defines the mapping

_updateTargetParam(self, param)

 

Updates the mapped object from the param value on the model object.

Parameters:
  • param (parameters.AbstractParam) - the abstract param that defines the mapping