#14828: Do not create a view when creating a grid from the Python API

Previously a view was created and ACTNUM displayed when running with GUI.
Users can create a view explicitly through the API.

Fixes #14828.
This commit is contained in:
Kristian Bendiksen committed 2026-10-02 14:03:55 +02:00
1 parent f015af98ee
commit 1cfe49262a
2 files changed
+16 -19

No files matched your search

@@ -28,7 +28,6 @@
#include "RiaPreferencesGrid.h"
#include "RiaQStringFormatter.h"
#include "RiaRegressionTestRunner.h"
#include "RiaResultNames.h"
#include "ExportCommands/RicSnapshotAllPlotsToFileFeature.h"
#include "ExportCommands/RicSnapshotAllViewsToFileFeature.h"
@@ -46,8 +45,6 @@
#include "RimCase.h"
#include "RimCornerPointCase.h"
#include "RimEclipseCaseCollection.h"
#include "RimEclipseCellColors.h"
#include "RimEclipseView.h"
#include "RimFileSummaryCase.h"
#include "RimGeneric3dView.h"
#include "RimGenericViewCollection.h"
@@ -324,22 +321,7 @@ std::expected<caf::PdmObjectHandle*, QString> RimProject_createGridFromKeyValues
RimMainPlotCollection::current()->ensureDefaultFlowPlotsAreCreated();
if ( RiaGuiApplication::isRunning() )
{
if ( RimEclipseView* riv = grid->createAndAddReservoirView() )
{
riv->loadDataAndUpdate();
if ( !riv->cellResult()->hasResult() )
{
riv->cellResult()->setResultVariable( RiaResultNames::undefinedResultName() );
}
analysisModels->updateConnectedEditors();
if ( RiuMainWindow::instance() ) RiuMainWindow::instance()->selectAsCurrentItem( riv->cellResult() );
}
}
analysisModels->updateConnectedEditors();
keyValueStore->remove( m_coordKey().toStdString() );
keyValueStore->remove( m_zcornKey().toStdString() );
@@ -204,6 +204,21 @@ def test_create_corner_point_grid_geometry_properties(rips_instance, initialize_
assert values["DEPTH"][active_index] == pytest.approx(1050.0 + k * 100.0)
def test_create_corner_point_grid_does_not_create_view(rips_instance, initialize_test):
"""Creating a grid from the python API must not create a view (issue #14828)."""
nx, ny, nz = 1, 1, 1
coord = [0, 0, 1000, 0, 0, 1100] * 4
zcorn = [1000] * 4 + [1100] * 4
actnum = [1]
case = rips_instance.project.create_corner_point_grid(
"NoViewGrid", nx, ny, nz, coord, zcorn, actnum
)
assert len(case.views()) == 0
def test_export_corner_point_grid_return_types(rips_instance, initialize_test):
"""Test that export_corner_point_grid returns the correct types"""