#846 Make sure plots widgets are updated when the plot main window is created

This commit is contained in:
Magne Sjaastad 2016-10-05 10:04:41 +02:00
parent b62bf68c07
commit 98643a7b84
3 changed files with 46 additions and 35 deletions

View File

@ -506,6 +506,42 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi
m_project->viewLinkerCollection()->viewLinker()->updateOverrides();
}
loadAndUpdatePlotData();
// NB! This function must be called before executing command objects,
// because the tree view state is restored from project file and sets
// current active view ( see restoreTreeViewState() )
// Default behavior for scripts is to use current active view for data read/write
onProjectOpenedOrClosed();
processEvents();
// Loop over command objects and execute them
for (size_t i = 0; i < m_project->commandObjects.size(); i++)
{
m_commandQueue.push_back(m_project->commandObjects[i]);
}
// Lock the command queue
m_commandQueueLock.lock();
// Execute command objects, and release the mutex when the queue is empty
executeCommandObjects();
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaApplication::loadProject(const QString& projectFileName)
{
return loadProject(projectFileName, PLA_NONE, NULL);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaApplication::loadAndUpdatePlotData()
{
RimWellLogPlotCollection* wlpColl = nullptr;
RimSummaryPlotCollection* spColl = nullptr;
@ -541,37 +577,6 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi
}
}
}
// NB! This function must be called before executing command objects,
// because the tree view state is restored from project file and sets
// current active view ( see restoreTreeViewState() )
// Default behavior for scripts is to use current active view for data read/write
onProjectOpenedOrClosed();
processEvents();
// Loop over command objects and execute them
for (size_t i = 0; i < m_project->commandObjects.size(); i++)
{
m_commandQueue.push_back(m_project->commandObjects[i]);
}
// Lock the command queue
m_commandQueueLock.lock();
// Execute command objects, and release the mutex when the queue is empty
executeCommandObjects();
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaApplication::loadProject(const QString& projectFileName)
{
return loadProject(projectFileName, PLA_NONE, NULL);
}
//--------------------------------------------------------------------------------------------------
/// Add a list of well path file paths (JSON files) to the well path collection
@ -1385,6 +1390,7 @@ RiuMainPlotWindow* RiaApplication::getOrCreateAndShowMainPlotWindow()
if (!m_mainPlotWindow)
{
createMainPlotWindow();
loadAndUpdatePlotData();
}
m_mainPlotWindow->show();

View File

@ -200,6 +200,7 @@ private:
};
bool loadProject(const QString& projectFileName, ProjectLoadAction loadAction, RiaProjectModifier* projectModifier);
void onProjectOpenedOrClosed();
std::vector<QString> readFileListFromTextFile(QString listFileName);
void setWindowCaptionFromAppState();
@ -210,6 +211,8 @@ private:
void createMainPlotWindow();
void deleteMainPlotWindow();
void loadAndUpdatePlotData();
private slots:
void slotWorkerProcessFinished(int exitCode, QProcess::ExitStatus exitStatus);

View File

@ -304,6 +304,8 @@ void RimSummaryPlot::loadDataAndUpdate()
//--------------------------------------------------------------------------------------------------
void RimSummaryPlot::updateZoom()
{
if (!m_qwtPlot) return;
// Todo: introduce autoscale
if(m_visibleWindow().size() == 4)