mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#5020 Flow Diag : Avoid creating plots in constructor to make pytest work
This commit is contained in:
@@ -96,6 +96,14 @@ bool RiaImportEclipseCaseTools::openEclipseCasesFromFile( const QStringList& fil
|
||||
}
|
||||
}
|
||||
|
||||
if ( !openedFiles.empty() )
|
||||
{
|
||||
if ( project && project->mainPlotCollection() )
|
||||
{
|
||||
project->mainPlotCollection()->ensureDefaultFlowPlotsAreCreated();
|
||||
}
|
||||
}
|
||||
|
||||
// Import summary cases
|
||||
if ( !summaryFileInfos.empty() )
|
||||
{
|
||||
|
||||
@@ -144,6 +144,14 @@ void RimFlowPlotCollection::addFlowCharacteristicsPlotToStoredPlots( RimFlowChar
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellAllocationPlot* RimFlowPlotCollection::defaultWellAllocPlot()
|
||||
{
|
||||
if ( !m_defaultWellAllocPlot() )
|
||||
{
|
||||
m_defaultWellAllocPlot = new RimWellAllocationPlot;
|
||||
m_defaultWellAllocPlot->setDescription( "Default Flow Diagnostics Plot" );
|
||||
}
|
||||
|
||||
this->updateConnectedEditors();
|
||||
|
||||
return m_defaultWellAllocPlot();
|
||||
}
|
||||
|
||||
@@ -152,32 +160,29 @@ RimWellAllocationPlot* RimFlowPlotCollection::defaultWellAllocPlot()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimFlowCharacteristicsPlot* RimFlowPlotCollection::defaultFlowCharacteristicsPlot()
|
||||
{
|
||||
if ( !m_flowCharacteristicsPlot() )
|
||||
{
|
||||
m_flowCharacteristicsPlot = new RimFlowCharacteristicsPlot;
|
||||
}
|
||||
|
||||
this->updateConnectedEditors();
|
||||
|
||||
return m_flowCharacteristicsPlot();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFlowPlotCollection::ensureDefaultPlotsAreCreated()
|
||||
void RimFlowPlotCollection::ensureDefaultFlowPlotsAreCreated()
|
||||
{
|
||||
bool isUpdateRequired = false;
|
||||
|
||||
if ( !m_flowCharacteristicsPlot() )
|
||||
{
|
||||
m_flowCharacteristicsPlot = new RimFlowCharacteristicsPlot;
|
||||
isUpdateRequired = true;
|
||||
}
|
||||
|
||||
if ( !m_defaultWellAllocPlot() )
|
||||
{
|
||||
m_defaultWellAllocPlot = new RimWellAllocationPlot;
|
||||
m_defaultWellAllocPlot->setDescription( "Default Flow Diagnostics Plot" );
|
||||
|
||||
isUpdateRequired = true;
|
||||
}
|
||||
|
||||
if ( isUpdateRequired )
|
||||
if ( !m_flowCharacteristicsPlot() )
|
||||
{
|
||||
this->updateConnectedEditors();
|
||||
m_flowCharacteristicsPlot = new RimFlowCharacteristicsPlot;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,8 +45,7 @@ public:
|
||||
void addFlowCharacteristicsPlotToStoredPlots( RimFlowCharacteristicsPlot* plot );
|
||||
RimWellAllocationPlot* defaultWellAllocPlot();
|
||||
RimFlowCharacteristicsPlot* defaultFlowCharacteristicsPlot();
|
||||
|
||||
void ensureDefaultPlotsAreCreated();
|
||||
void ensureDefaultFlowPlotsAreCreated();
|
||||
|
||||
private:
|
||||
caf::PdmChildField<RimFlowCharacteristicsPlot*> m_flowCharacteristicsPlot;
|
||||
|
||||
@@ -154,6 +154,8 @@ RimWellAllocationPlot::~RimWellAllocationPlot()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellAllocationPlot::setFromSimulationWell( RimSimWellInView* simWell )
|
||||
{
|
||||
m_showWindow = true;
|
||||
|
||||
RimEclipseView* eclView;
|
||||
simWell->firstAncestorOrThisOfType( eclView );
|
||||
RimEclipseResultCase* eclCase;
|
||||
@@ -170,8 +172,6 @@ void RimWellAllocationPlot::setFromSimulationWell( RimSimWellInView* simWell )
|
||||
m_flowDiagSolution = m_case->defaultFlowDiagSolution();
|
||||
}
|
||||
|
||||
m_showWindow = true;
|
||||
|
||||
onLoadDataAndUpdate();
|
||||
}
|
||||
|
||||
|
||||
@@ -305,5 +305,5 @@ void RimMainPlotCollection::deleteAllCachedData()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMainPlotCollection::ensureDefaultFlowPlotsAreCreated()
|
||||
{
|
||||
m_flowPlotCollection()->ensureDefaultPlotsAreCreated();
|
||||
m_flowPlotCollection()->ensureDefaultFlowPlotsAreCreated();
|
||||
}
|
||||
|
||||
@@ -66,7 +66,6 @@ public:
|
||||
void updatePlotsWithFormations();
|
||||
void updatePlotsWithCompletions();
|
||||
void deleteAllCachedData();
|
||||
|
||||
void ensureDefaultFlowPlotsAreCreated();
|
||||
|
||||
private:
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include "RiaSummaryTools.h"
|
||||
|
||||
#include "RimEnsembleCurveSetCollection.h"
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryCaseMainCollection.h"
|
||||
#include "RimSummaryCurveCollection.h"
|
||||
@@ -99,8 +98,7 @@ QString RiuPlotMainWindow::mainWindowName()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuPlotMainWindow::initializeGuiNewProjectLoaded()
|
||||
{
|
||||
auto project = RiaApplication::instance()->project();
|
||||
setPdmRoot( project );
|
||||
setPdmRoot( RiaApplication::instance()->project() );
|
||||
restoreTreeViewState();
|
||||
|
||||
if ( m_pdmUiPropertyView && m_pdmUiPropertyView->currentObject() )
|
||||
@@ -142,11 +140,6 @@ void RiuPlotMainWindow::initializeGuiNewProjectLoaded()
|
||||
}
|
||||
|
||||
refreshToolbars();
|
||||
|
||||
if ( project && project->mainPlotCollection() )
|
||||
{
|
||||
project->mainPlotCollection()->ensureDefaultFlowPlotsAreCreated();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user