diff --git a/Code/Mantid/Framework/API/inc/MantidAPI/Algorithm.h b/Code/Mantid/Framework/API/inc/MantidAPI/Algorithm.h index 98b9df4811e8f22dd235b5f6517adae336e9e093..6d7a140d6c03eb68704ca815ae6d644a23805d6f 100644 --- a/Code/Mantid/Framework/API/inc/MantidAPI/Algorithm.h +++ b/Code/Mantid/Framework/API/inc/MantidAPI/Algorithm.h @@ -223,7 +223,7 @@ public: /// Raises the cancel flag. interuption_point() method if called inside exec() checks this flag /// and if true terminates the algorithm. - void cancel()const; + virtual void cancel()const; /// True if the algorithm is running asynchronously. bool isRunningAsync(){return m_runningAsync;} /// True if the algorithm is running. diff --git a/Code/Mantid/Framework/DataHandling/inc/MantidDataHandling/Load.h b/Code/Mantid/Framework/DataHandling/inc/MantidDataHandling/Load.h index 4233601b198f93e30a6011d9f5ba8a1dfc3bcc7c..60b89e642ea91f3d7344d7885975b983dc28cc36 100644 --- a/Code/Mantid/Framework/DataHandling/inc/MantidDataHandling/Load.h +++ b/Code/Mantid/Framework/DataHandling/inc/MantidDataHandling/Load.h @@ -72,6 +72,8 @@ namespace Mantid void init(); /// Execute void exec(); + /// Overrides the cancel() method to call m_loader->cancel() + void cancel()const; /// Create the concrete instance use for the actual loading. API::IDataFileChecker_sptr createLoader(const std::string & name, const double startProgress = -1.0, const double endProgress=-1.0, const bool logging = true) const; @@ -88,6 +90,8 @@ namespace Mantid private: /// The base properties std::set<std::string> m_baseProps; + /// The actual loader + API::IDataFileChecker_sptr m_loader; }; } // namespace DataHandling diff --git a/Code/Mantid/Framework/DataHandling/src/Load.cpp b/Code/Mantid/Framework/DataHandling/src/Load.cpp index 3200353494239d229276e516ff4bbfd4b090d928..e29e91c5e6bd81d964f2177655e9c240c08f03c0 100644 --- a/Code/Mantid/Framework/DataHandling/src/Load.cpp +++ b/Code/Mantid/Framework/DataHandling/src/Load.cpp @@ -226,20 +226,20 @@ namespace Mantid void Load::exec() { std::string loaderName = getPropertyValue("LoaderName"); - IDataFileChecker_sptr loader; + //IDataFileChecker_sptr loader; if( loaderName.empty() ) { - loader = getFileLoader(getPropertyValue("Filename")); - loaderName = loader->name(); + m_loader = getFileLoader(getPropertyValue("Filename")); + loaderName = m_loader->name(); setPropertyValue("LoaderName",loaderName); } else { - loader = createLoader(loaderName,0,1); + m_loader = createLoader(loaderName,0,1); } - g_log.information() << "Using " << loaderName << " version " << loader->version() << ".\n"; + g_log.information() << "Using " << loaderName << " version " << m_loader->version() << ".\n"; ///get the list properties for the concrete loader load algorithm - const std::vector<Kernel::Property*> & loader_props = loader->getProperties(); + const std::vector<Kernel::Property*> & loader_props = m_loader->getProperties(); // Loop through and set the properties on the sub algorithm std::vector<Kernel::Property*>::const_iterator itr; @@ -248,18 +248,18 @@ namespace Mantid const std::string propName = (*itr)->name(); if( this->existsProperty(propName) ) { - loader->setPropertyValue(propName, getPropertyValue(propName)); + m_loader->setPropertyValue(propName, getPropertyValue(propName)); } - else if( propName == loader->filePropertyName() ) + else if( propName == m_loader->filePropertyName() ) { - loader->setPropertyValue(propName, getPropertyValue("Filename")); + m_loader->setPropertyValue(propName, getPropertyValue("Filename")); } } // Execute the concrete loader - loader->execute(); + m_loader->execute(); // Set the workspace. Deals with possible multiple periods - setOutputWorkspace(loader); + setOutputWorkspace(m_loader); } /** @@ -382,5 +382,16 @@ namespace Mantid return Workspace_sptr(); } + /* + * Overrides the default cancel() method. Calls cancel() on the actual loader. + */ + void Load::cancel()const + { + if (m_loader) + { + m_loader->cancel(); + } + } + } // namespace DataHandling } // namespace Mantid diff --git a/Code/Mantid/MantidPlot/src/Mantid/AlgMonitor.cpp b/Code/Mantid/MantidPlot/src/Mantid/AlgMonitor.cpp index edfb77b00b14614db8d092d53e5ab8dbcf173741..73cab18a95176b4699445ce30cc27331bd44d92d 100644 --- a/Code/Mantid/MantidPlot/src/Mantid/AlgMonitor.cpp +++ b/Code/Mantid/MantidPlot/src/Mantid/AlgMonitor.cpp @@ -50,6 +50,7 @@ void AlgorithmMonitor::add(IAlgorithm_sptr alg) emit algorithmStarted(alg->getAlgorithmID()); emit countChanged(); unlock(); + m_mantidUI->showAlgWidget(); } void AlgorithmMonitor::remove(const IAlgorithm* alg) diff --git a/Code/Mantid/MantidPlot/src/Mantid/MantidUI.cpp b/Code/Mantid/MantidPlot/src/Mantid/MantidUI.cpp index 31f977b56b709ee4c588bd50d3c5abb143299744..9e6a71825caaff634048eb63e21cf33ba6a7c8ac 100644 --- a/Code/Mantid/MantidPlot/src/Mantid/MantidUI.cpp +++ b/Code/Mantid/MantidPlot/src/Mantid/MantidUI.cpp @@ -190,6 +190,19 @@ void MantidUI::updateAlgorithms() m_exploreAlgorithms->update(); } +/// Show / hide the AlgorithmDockWidget +void MantidUI::showAlgWidget(bool on) +{ + if (on) + { + m_exploreAlgorithms->show(); + } + else + { + m_exploreAlgorithms->hide(); + } +} + void MantidUI::addMenuItems(QMenu *menu) { actionToggleMantid = m_exploreMantid->toggleViewAction(); diff --git a/Code/Mantid/MantidPlot/src/Mantid/MantidUI.h b/Code/Mantid/MantidPlot/src/Mantid/MantidUI.h index c82a134094112f51ce642b301b942f174ea321ab..59fc483f5a0a8c95b6316db51dd6ad8f04724fc9 100644 --- a/Code/Mantid/MantidPlot/src/Mantid/MantidUI.h +++ b/Code/Mantid/MantidPlot/src/Mantid/MantidUI.h @@ -183,8 +183,10 @@ public: void executeDownloadDataFiles(const std::vector<std::string>& filenNames,const std::vector<long long>& fileIds); AlgorithmMonitor* getAlgMonitor(){return m_algMonitor;} - //updates the algorithms tree + /// updates the algorithms tree void updateAlgorithms(); + /// Show the algorithm dock widget + void showAlgWidget(bool on = true); bool runAlgorithmAsync_PyCallback(const QString & algName);