Skip to content

Commit

Permalink
Refs #5012 Swap IDA interface to run LoadNexus C++ side.
Browse files Browse the repository at this point in the history
This algorithm was being executed on a separate thread which was causing
the automatic file searching to play up in certain cases where it would
still be searching for files while the user had clicked the run button.

This change stops that from happening, but this should really be changed
to use AlgorithmRunner. But that's outside the scope of this ticket.
  • Loading branch information
Samuel Jackson committed Apr 16, 2014
1 parent 256658c commit 5079b9b
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions Code/Mantid/MantidQt/CustomInterfaces/src/IDATab.cpp
@@ -1,5 +1,6 @@
#include "MantidQtCustomInterfaces/IDATab.h"
#include "MantidAPI/MatrixWorkspace.h"
#include "MantidAPI/AlgorithmManager.h"
#include "MantidAPI/AnalysisDataService.h"
#include "boost/shared_ptr.hpp"

Expand Down Expand Up @@ -113,13 +114,17 @@ namespace IDA
MatrixWorkspace_const_sptr IDATab::runLoadNexus(const QString & filename, const QString & wsname)
{
using Mantid::Kernel::Exception::NotFoundError;

QString pyInput = "LoadNexus(Filename=r'" + filename + "', OutputWorkspace='" + wsname + "')";
runPythonCode(pyInput);

using Mantid::API::AlgorithmManager;

auto loadNexus = AlgorithmManager::Instance().create("LoadNexus");
loadNexus->setRethrows(true);
loadNexus->setPropertyValue("Filename", filename.toStdString());
loadNexus->setPropertyValue("OutputWorkspace", wsname.toStdString());

MatrixWorkspace_const_sptr ws;
try
{
loadNexus->execute();
ws = AnalysisDataService::Instance().retrieveWS<const MatrixWorkspace>(wsname.toStdString());
}
catch(NotFoundError&)
Expand Down

0 comments on commit 5079b9b

Please sign in to comment.