Skip to content
Snippets Groups Projects
Commit 26b6fea6 authored by Matthew Andrew's avatar Matthew Andrew
Browse files

Added check before redraw in ContourPreviewPlot Re #28436

Without these added checks the contour plot was being redrawn any time any workspace was replaced or deleted from the ADS leading to significant slowdowns in some operations when the interface was open.
parent 692f0d6e
No related branches found
No related tags found
No related merge requests found
...@@ -68,11 +68,15 @@ void ContourPreviewPlot::onWorkspaceRemoved( ...@@ -68,11 +68,15 @@ void ContourPreviewPlot::onWorkspaceRemoved(
if (auto workspace = if (auto workspace =
boost::dynamic_pointer_cast<MatrixWorkspace>(nf->object())) { boost::dynamic_pointer_cast<MatrixWorkspace>(nf->object())) {
// If the artist has already been removed, ignore. // If the artist has already been removed, ignore.
bool workspaceRemoved = false;
try { try {
m_canvas->gca<MantidAxes>().removeWorkspaceArtists(workspace); workspaceRemoved =
m_canvas->gca<MantidAxes>().removeWorkspaceArtists(workspace);
} catch (Mantid::PythonInterface::PythonException &) { } catch (Mantid::PythonInterface::PythonException &) {
} }
m_canvas->draw(); if (workspaceRemoved) {
m_canvas->draw();
}
} }
} }
...@@ -86,8 +90,9 @@ void ContourPreviewPlot::onWorkspaceReplaced( ...@@ -86,8 +90,9 @@ void ContourPreviewPlot::onWorkspaceReplaced(
boost::dynamic_pointer_cast<MatrixWorkspace>(nf->oldObject())) { boost::dynamic_pointer_cast<MatrixWorkspace>(nf->oldObject())) {
if (auto newWorkspace = if (auto newWorkspace =
boost::dynamic_pointer_cast<MatrixWorkspace>(nf->newObject())) { boost::dynamic_pointer_cast<MatrixWorkspace>(nf->newObject())) {
m_canvas->gca<MantidAxes>().replaceWorkspaceArtists(newWorkspace); if (m_canvas->gca<MantidAxes>().replaceWorkspaceArtists(newWorkspace)) {
m_canvas->draw(); m_canvas->draw();
}
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment