#15098: Report snapshot export failures through the Python API

This commit is contained in:
Magne Sjaastad committed 2026-11-03 15:23:31 +01:00
1 parent 56074d1317
commit 58ebaf5d0d
2 files changed
+19 -4

No files matched your search

@@ -687,9 +687,12 @@ std::expected<caf::PdmObjectHandle*, QString> RimProject_exportSnapshots::execut
const bool exportViews = m_contentType() != RiaDefines::SnapshotContentType::PLOTS;
const bool exportPlots = m_contentType() != RiaDefines::SnapshotContentType::VIEWS;
QStringList snapshotErrors;
if ( exportViews )
{
RicSnapshotAllViewsToFileFeature::exportSnapshotOfViewsIntoFolder( exportFolder, width, height, m_prefix() );
auto result = RicSnapshotAllViewsToFileFeature::exportSnapshotOfViewsIntoFolder( exportFolder, width, height, m_prefix() );
if ( !result ) snapshotErrors.push_back( result.error() );
}
if ( exportPlots )
@@ -697,9 +700,13 @@ std::expected<caf::PdmObjectHandle*, QString> RimProject_exportSnapshots::execut
const bool activateWidget = !RiaRegressionTestRunner::instance()->isRunningRegressionTests();
const QString fileSuffix = m_plotFileFormat() == RiaDefines::SnapshotFileFormat::PDF ? ".pdf" : ".png";
RicSnapshotAllPlotsToFileFeature::exportSnapshotOfPlotsIntoFolder( exportFolder, width, height, activateWidget, m_prefix(), -1, fileSuffix );
auto result =
RicSnapshotAllPlotsToFileFeature::exportSnapshotOfPlotsIntoFolder( exportFolder, width, height, activateWidget, m_prefix(), -1, fileSuffix );
if ( !result ) snapshotErrors.push_back( result.error() );
}
if ( !snapshotErrors.empty() ) return std::unexpected( snapshotErrors.join( ". " ) );
return nullptr;
}
@@ -125,7 +125,10 @@ std::expected<caf::PdmObjectHandle*, QString> RimViewWindow_exportSnapshot::exec
{
if ( !view3d->viewer() ) return std::unexpected( QString( "View '%1' has no viewer." ).arg( view3d->name() ) );
RicSnapshotAllViewsToFileFeature::exportSnapshotOfView( view3d, exportFolder, width, height, m_prefix() );
if ( auto result = RicSnapshotAllViewsToFileFeature::exportSnapshotOfView( view3d, exportFolder, width, height, m_prefix() ); !result )
{
return std::unexpected( result.error() );
}
return nullptr;
}
@@ -134,7 +137,12 @@ std::expected<caf::PdmObjectHandle*, QString> RimViewWindow_exportSnapshot::exec
const bool activateWidget = !RiaRegressionTestRunner::instance()->isRunningRegressionTests();
const QString fileSuffix = m_fileFormat() == RiaDefines::SnapshotFileFormat::PDF ? ".pdf" : ".png";
RicSnapshotAllPlotsToFileFeature::exportSnapshotOfPlot( viewWindow, exportFolder, width, height, activateWidget, m_prefix(), fileSuffix );
if ( auto result =
RicSnapshotAllPlotsToFileFeature::exportSnapshotOfPlot( viewWindow, exportFolder, width, height, activateWidget, m_prefix(), fileSuffix );
!result )
{
return std::unexpected( result.error() );
}
return nullptr;
}