Package topo :: Package base :: Module parameterclasses :: Class CallableParameter
[hide private]
[frames] | no frames]

Class CallableParameter

source code

                   object --+    
                            |    
parameterizedobject.Parameter --+
                                |
                               CallableParameter
Known Subclasses:
tkgui.tkparameterizedobject.ButtonParameter

Parameter holding a value that is a callable object, such as a function.

A keyword argument instantiate=True should be provided when a function object is used that might have state. On the other hand, regular standalone functions cannot be deepcopied as of Python 2.4, so instantiate must be False for those values.



Nested Classes [hide private]

Inherited from parameterizedobject.Parameter: __metaclass__

Instance Methods [hide private]
 
__init__(self, default=None, **params)
Initialize a new Parameter object: store the supplied attributes.
source code
 
__set__(self, obj, val)
Set the value for this Parameter.
source code

Inherited from parameterizedobject.Parameter: __delete__, __get__, __getstate__, __setstate__

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

Class Variables [hide private]
  __classdoc = '\n Parameter holding a value that is a callab...
str(object) -> string
Properties [hide private]

Inherited from parameterizedobject.Parameter: constant, default, doc, instantiate, precedence, readonly

Inherited from object: __class__

Method Details [hide private]

__init__(self, default=None, **params)
(Constructor)

source code 

Initialize a new Parameter object: store the supplied attributes.

default: the owning class's value for the attribute represented by this Parameter.

precedence is a value, usually in the range 0.0 to 1.0, that allows the order of Parameters in a class to be defined (for e.g. in GUI menus). A negative precedence indicates a parameter that should be hidden in e.g. GUI menus.

default, doc, and precedence default to None. This is to allow inheritance of Parameter slots (attributes) from the owning-class' class hierarchy (see ParameterizedObjectMetaclass).

Overrides: parameterizedobject.Parameter.__init__
(inherited documentation)

__set__(self, obj, val)

source code 

Set the value for this Parameter.

If called for a ParameterizedObject class, set that class's value (i.e. set this Parameter object's 'default' attribute).

If called for a ParameterizedObject instance, set the value of this Parameter on that instance (i.e. in the instance's __dict__, under the parameter's internal_name).

If the Parameter's constant attribute is True, only allows the value to be set for a ParameterizedObject class or on uninitialized ParameterizedObject instances.

If the Parameter's readonly attribute is True, only allows the value to be specified in the Parameter declaration inside the ParameterizedObject source code. A read-only parameter also cannot be set on a ParameterizedObject class.

Note that until we support some form of read-only object, it is still possible to change the attributes of the object stored in a constant or read-only Parameter (e.g. the left bound of a BoundingBox).

Overrides: parameterizedobject.Parameter.__set__
(inherited documentation)

Class Variable Details [hide private]

__classdoc

str(object) -> string

Return a nice string representation of the object. If the argument is a string, the return value is the same object.

Value:
'''
    Parameter holding a value that is a callable object, such as a function.
    
    A keyword argument instantiate=True should be provided when a
    function object is used that might have state.  On the other hand,
    regular standalone functions cannot be deepcopied as of Python
    2.4, so instantiate must be False for those values.
    '''