X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FParametersPlugin%2FParametersPlugin_EvalListener.cpp;h=126b0b0f0346ba509e2bfa9ff761066530d59eed;hb=5a4405dc843479d921b53b83c181cbe9359414fe;hp=3d5212bfb25db258485de23eddf5231d1ebecd68;hpb=7807756f46b9dcd90994ac57a8a514f0570e794e;p=modules%2Fshaper.git diff --git a/src/ParametersPlugin/ParametersPlugin_EvalListener.cpp b/src/ParametersPlugin/ParametersPlugin_EvalListener.cpp index 3d5212bfb..126b0b0f0 100644 --- a/src/ParametersPlugin/ParametersPlugin_EvalListener.cpp +++ b/src/ParametersPlugin/ParametersPlugin_EvalListener.cpp @@ -13,6 +13,8 @@ #include +#include +#include #include #include #include @@ -21,7 +23,6 @@ #include #include -#include #include #include @@ -116,6 +117,18 @@ void ParametersPlugin_EvalListener::processEvaluationEvent( std::shared_ptr aMessage = std::dynamic_pointer_cast(theMessage); + if (aMessage->attribute()->attributeType() == ModelAPI_AttributeInteger::typeId()) { + AttributeIntegerPtr anAttribute = + std::dynamic_pointer_cast(aMessage->attribute()); + std::string anError; + int aValue = (int)evaluate(anAttribute->text(), anError, anAttribute->owner()->document()); + bool isValid = anError.empty(); + if (isValid) + anAttribute->setCalculatedValue(aValue); + anAttribute->setUsedParameters(isValid ? toSet(myInterp->compile(anAttribute->text())) : std::set()); + anAttribute->setExpressionInvalid(!isValid); + anAttribute->setExpressionError(anAttribute->text().empty() ? "" : anError); + } else if (aMessage->attribute()->attributeType() == ModelAPI_AttributeDouble::typeId()) { AttributeDoublePtr anAttribute = std::dynamic_pointer_cast(aMessage->attribute()); @@ -241,6 +254,14 @@ void ParametersPlugin_EvalListener::renameInAttribute( const std::string& theOldName, const std::string& theNewName) { + if (theAttribute->attributeType() == ModelAPI_AttributeInteger::typeId()) { + AttributeIntegerPtr anAttribute = + std::dynamic_pointer_cast(theAttribute); + std::string anExpressionString = anAttribute->text(); + anExpressionString = renameInPythonExpression(anExpressionString, + theOldName, theNewName); + anAttribute->setText(anExpressionString); + } else if (theAttribute->attributeType() == ModelAPI_AttributeDouble::typeId()) { AttributeDoublePtr anAttribute = std::dynamic_pointer_cast(theAttribute);