diff --git a/Code/Mantid/Framework/API/inc/MantidAPI/AlgorithmObserver.h b/Code/Mantid/Framework/API/inc/MantidAPI/AlgorithmObserver.h index 0c43024f1a7c6bb0653f341b38ff6ab0d6fe5f3e..421ea7bdb294a2be92eca8d0149614245829ee5d 100644 --- a/Code/Mantid/Framework/API/inc/MantidAPI/AlgorithmObserver.h +++ b/Code/Mantid/Framework/API/inc/MantidAPI/AlgorithmObserver.h @@ -137,6 +137,14 @@ public: alg->removeObserver(m_errorObserver); } + /** + * Disconnect from the algorithm manager. + */ + void stopObservingManager() + { + AlgorithmManager::Instance().notificationCenter.removeObserver(m_startingObserver); + } + /// @cond Doxygen cannot handle the macro around the argument name /** Handler of the progress notifications. Must be overriden in inherited classes. diff --git a/Code/Mantid/Framework/Algorithms/src/RecordPythonScript.cpp b/Code/Mantid/Framework/Algorithms/src/RecordPythonScript.cpp index af29ee2a5c7568a81588dbc4538be5b61aebdb18..d1fbf8b33b05ef14efcd5a0f125dfc04e3e9d339 100644 --- a/Code/Mantid/Framework/Algorithms/src/RecordPythonScript.cpp +++ b/Code/Mantid/Framework/Algorithms/src/RecordPythonScript.cpp @@ -85,6 +85,8 @@ void RecordPythonScript::exec() file << m_generatedScript; file.flush(); file.close(); + + stopObservingManager(); } /** Handler of the start notifications. Adds an algorithm call to the script. @@ -92,15 +94,7 @@ void RecordPythonScript::exec() */ void RecordPythonScript::startingHandle(API::IAlgorithm_sptr alg) { - std::cerr << "Started " << alg->name() << std::endl; auto props= alg->getProperties(); - for( auto p = props.begin(); p != props.end(); ++p) - { - std::cerr << (**p).name() << '=' << (**p).value() << std::endl; - } - // Get the details of this algorithm history. - const std::string name = alg->name(); - const int version = alg->version(); std::string algString; for(auto p = props.begin() ; p != props.end(); ++p) @@ -118,7 +112,7 @@ void RecordPythonScript::startingHandle(API::IAlgorithm_sptr alg) } } - m_generatedScript += name + "(" + algString + ")\n"; + m_generatedScript += alg->name() + "(" + algString + ")\n"; }