Support setting well log plot fields from Python

This commit is contained in:
Gaute Lindkvist
2020-01-21 11:08:09 +01:00
parent 56d141d4c3
commit 896767c991
4 changed files with 60 additions and 6 deletions

View File

@@ -115,7 +115,11 @@ void RiaGrpcServiceInterface::copyPdmObjectFromRipsToCaf( const rips::PdmObject*
QString keyword = pdmValueField->keyword();
QString value = QString::fromStdString( parametersMap[keyword.toStdString()] );
assignFieldValue( value, pdmValueField );
QVariant oldValue, newValue;
if ( assignFieldValue( value, pdmValueField, &oldValue, &newValue ) )
{
destination->uiCapability()->fieldChangedByUi( field, oldValue, newValue );
}
}
}
}
@@ -123,15 +127,24 @@ void RiaGrpcServiceInterface::copyPdmObjectFromRipsToCaf( const rips::PdmObject*
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaGrpcServiceInterface::assignFieldValue( const QString& stringValue, caf::PdmValueField* field )
bool RiaGrpcServiceInterface::assignFieldValue( const QString& stringValue,
caf::PdmValueField* field,
QVariant* oldValue,
QVariant* newValue )
{
CAF_ASSERT( oldValue && newValue );
auto ricfHandle = field->template capability<RicfFieldHandle>();
if ( field && ricfHandle != nullptr )
{
QTextStream stream( stringValue.toLatin1() );
RicfMessages messages;
*oldValue = field->toQVariant();
ricfHandle->readFieldData( stream, nullptr, &messages, false );
*newValue = field->toQVariant();
return true;
}
return false;
}
//--------------------------------------------------------------------------------------------------