mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-26 23:20:29 -05:00
Python: Reject summary writes for unsupported case types
This commit is contained in:
1 parent
ef1ad39723
commit
f32d59775b
2 files changed
+40
-20
No files matched your search
@@ -244,34 +244,38 @@ std::expected<caf::PdmObjectHandle*, QString> RimSummaryCase_setSummaryVectorVal
|
||||
{
|
||||
auto* summaryCase = self<RimSummaryCase>();
|
||||
auto* fileSummaryCase = dynamic_cast<RimFileSummaryCase*>( summaryCase );
|
||||
if ( fileSummaryCase )
|
||||
if ( !fileSummaryCase )
|
||||
{
|
||||
bool rebuildUserInterface = true;
|
||||
return std::unexpected( QString( "Setting summary values is not supported for summary case type '%1'. "
|
||||
"Only file-backed summary cases support user-defined vectors." )
|
||||
.arg( summaryCase->classKeyword() ) );
|
||||
}
|
||||
|
||||
if ( auto reader = fileSummaryCase->summaryReader() )
|
||||
bool rebuildUserInterface = true;
|
||||
|
||||
if ( auto reader = fileSummaryCase->summaryReader() )
|
||||
{
|
||||
auto allAddr = reader->allResultAddresses();
|
||||
for ( const auto& adr : allAddr )
|
||||
{
|
||||
auto allAddr = reader->allResultAddresses();
|
||||
for ( auto adr : allAddr )
|
||||
if ( adr.uiText() == m_addressString().toStdString() )
|
||||
{
|
||||
if ( adr.uiText() == m_addressString().toStdString() )
|
||||
{
|
||||
rebuildUserInterface = false;
|
||||
break;
|
||||
}
|
||||
rebuildUserInterface = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
auto result = fileSummaryCase->setSummaryData( m_addressString().toStdString(), m_unitString().toStdString(), m_values() );
|
||||
if ( !result.has_value() )
|
||||
{
|
||||
return std::unexpected( result.error() );
|
||||
}
|
||||
auto result = fileSummaryCase->setSummaryData( m_addressString().toStdString(), m_unitString().toStdString(), m_values() );
|
||||
if ( !result.has_value() )
|
||||
{
|
||||
return std::unexpected( result.error() );
|
||||
}
|
||||
|
||||
if ( rebuildUserInterface )
|
||||
{
|
||||
fileSummaryCase->buildTreeNodesIfRequired();
|
||||
fileSummaryCase->updateConnectedEditors();
|
||||
}
|
||||
if ( rebuildUserInterface )
|
||||
{
|
||||
fileSummaryCase->buildTreeNodesIfRequired();
|
||||
fileSummaryCase->updateConnectedEditors();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
|
||||
Reference in new issue
Block a user