Close project if cancelling well path loading.

This commit is contained in:
Kristian Bendiksen 2024-08-16 13:45:53 +02:00
parent 9bea739252
commit b324fdb26b
4 changed files with 15 additions and 4 deletions

View File

@ -548,7 +548,15 @@ bool RiaApplication::loadProject( const QString& projectFileName, ProjectLoadAct
}
// Initialize well paths
oilField->wellPathCollection->loadDataAndUpdate();
if ( !oilField->wellPathCollection->loadDataAndUpdate() )
{
// Opening well path was cancelled or failed: close project.
closeProject();
m_project = std::make_unique<RimProject>();
onProjectOpened();
return true;
}
oilField->ensembleWellLogsCollection->loadDataAndUpdate();
oilField->vfpDataCollection->loadDataAndUpdate();

View File

@ -149,7 +149,7 @@ void RimWellPathCollection::fieldChangedByUi( const caf::PdmFieldHandle* changed
//--------------------------------------------------------------------------------------------------
/// Read files containing well path data, or create geometry based on the targets
//--------------------------------------------------------------------------------------------------
void RimWellPathCollection::loadDataAndUpdate()
bool RimWellPathCollection::loadDataAndUpdate()
{
auto hasOsduData = []( const std::vector<RimWellPath*>& wellPaths ) -> bool
{
@ -200,7 +200,7 @@ void RimWellPathCollection::loadDataAndUpdate()
if ( progress.isCancelled() )
{
return;
return false;
}
progress.setProgressDescription( QString( "Reading well logs." ) );
@ -230,6 +230,8 @@ void RimWellPathCollection::loadDataAndUpdate()
rebuildWellPathNodes();
sortWellsByName();
return true;
}
//--------------------------------------------------------------------------------------------------

View File

@ -97,7 +97,7 @@ public:
caf::PdmField<bool> wellPathClip;
caf::PdmField<int> wellPathClipZDistance;
void loadDataAndUpdate();
bool loadDataAndUpdate();
std::vector<RimWellPath*> addWellPaths( QStringList filePaths, QStringList* errorMessages );
std::vector<RimWellPath*> allWellPaths() const;
void removeWellPath( gsl::not_null<RimWellPath*> wellPath );

View File

@ -695,6 +695,7 @@ void ProgressInfoStatic::finished()
if ( dialog )
{
QObject::disconnect( dialog, &QProgressDialog::canceled, nullptr, nullptr );
s_isButtonConnected = false;
dialog->reset();
dialog->close();