Package gavo :: Package base :: Module complexattrs :: Class UniquedStructListAttribute
[frames] | no frames]

Class UniquedStructListAttribute

source code

          object --+            
                   |            
attrdef.AttributeDef --+        
                       |        
         StructAttribute --+    
                           |    
         StructListAttribute --+
                               |
                              UniquedStructListAttribute

A StructListAttribute that will only admit one child per value of uniqueAttribute, overwriting existing entries if existing.

Actually, you can pass a policy="drop" argument to just keep an existing element and drop the new one.

Instance Methods
 
__init__(self, name, childFactory, uniqueAttribute, policy='overwrite', **kwargs)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
addStruct(self, instance, value)
adds a structure to the attribute's value.
source code

Inherited from StructListAttribute: feedObject, getCopy, iterChildren, iterEvents, makeUserDoc, onParentComplete, remove, replace

Inherited from StructAttribute: create, feed

Inherited from attrdef.AttributeDef: doCallbacks, iterParentMethods

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

Properties
  typeDesc_

Inherited from StructListAttribute: default_

Inherited from object: __class__

Method Details

__init__(self, name, childFactory, uniqueAttribute, policy='overwrite', **kwargs)
(Constructor)

source code 

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

Overrides: object.__init__
(inherited documentation)

addStruct(self, instance, value)

source code 

adds a structure to the attribute's value.

Do not directly add to the list, always go through this method; derived classes override it for special behaviour. Also, this is where callbacks are called.

Use destIndex to overwrite an (existing!) struct; default is appending.

Overrides: StructListAttribute.addStruct
(inherited documentation)

Property Details

typeDesc_

Get Method:
unreachable.typeDesc_(self)