Smart version of __setitem__ operator. Uses Parameter.smartSetValue() function for dynamic type conversion.
( self, attrName, attrValue )
| 41 | """ |
| 42 | |
| 43 | def __parameterisedSetItemOp( self, attrName, attrValue ): |
| 44 | """ |
| 45 | Smart version of __setitem__ operator. Uses Parameter.smartSetValue() function for |
| 46 | dynamic type conversion. |
| 47 | """ |
| 48 | try: |
| 49 | parameters = IECore.Parameterised.parameters( self ) |
| 50 | except: |
| 51 | # it's probably a derived class and the constructor did not initialized Parameterised. |
| 52 | # So the attribute must be a class attribute and not a Parameter attribute. |
| 53 | # \todo Might want to rethink this logic |
| 54 | self.__dict__[ attrName ] = attrValue |
| 55 | else: |
| 56 | if parameters.has_key( attrName ): |
| 57 | parameters[ attrName ].smartSetValue( attrValue ) |
| 58 | else: |
| 59 | # allow assignment of other attributes to the object. |
| 60 | self.__dict__[ attrName ] = attrValue |
| 61 | |
| 62 | IECore.Parameterised.__setitem__ = __parameterisedSetItemOp |
| 63 |
nothing calls this directly
no test coverage detected