Skip to content

Commit

Permalink
Re #8637. Make the GUI more responsive...
Browse files Browse the repository at this point in the history
...by running algorithms asynchronously and processing events in the
meantime so that the whole of MantidPlot doesn't lock up.
  • Loading branch information
RussellTaylor committed Jan 31, 2014
1 parent 3a794e0 commit e046a88
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions Code/Mantid/MantidQt/CustomInterfaces/src/StepScan.cpp
Expand Up @@ -291,7 +291,12 @@ bool StepScan::mergeRuns()
addScanIndex->setProperty("LogName","scan_index");
addScanIndex->setProperty("LogType","Number Series");
addScanIndex->setProperty("LogText",Strings::toString(i+1));
if ( ! addScanIndex->execute() ) return true;
auto result = addScanIndex->executeAsync();
while ( !result.available() )
{
QApplication::processEvents();
}
if ( ! addScanIndex->isExecuted() ) return true;

// Add a scan_index = 0 to the end time for each workspace
try
Expand All @@ -306,7 +311,12 @@ bool StepScan::mergeRuns()
merge->setPropertyValue("InputWorkspaces",m_inputWSName);
const std::string summedWSName = "__summed_multifiles";
merge->setPropertyValue("OutputWorkspace",summedWSName);
if ( ! merge->execute() ) return true;
auto result = merge->executeAsync();
while ( !result.available() )
{
QApplication::processEvents();
}
if ( ! merge->isExecuted() ) return true;
m_inputWSName = summedWSName;

return false;
Expand Down Expand Up @@ -484,7 +494,12 @@ void StepScan::runStepScanAlg()
}
stepScan->setPropertyValue("InputWorkspace", m_inputWSName);
ScopedStatusText _merging(this->m_uiForm.statusText,"Analyzing scan...");
algSuccessful = stepScan->execute();
auto result = stepScan->executeAsync();
while ( !result.available() )
{
QApplication::processEvents();
}
algSuccessful = stepScan->isExecuted();
}

if ( !algSuccessful )
Expand Down

0 comments on commit e046a88

Please sign in to comment.