13#include <Poco/ActiveResult.h>
14#include <QCoreApplication>
16#include <boost/algorithm/string/regex.hpp>
19namespace MantidWidgets {
35 if (session.size() == sessionIDs.size()) {
37 return catalogAlgorithm->getProperty(
"InstrumentList");
40 for (
const auto &sessionID : sessionIDs) {
41 catalogAlgorithm->setProperty(
"Session", sessionID);
45 return catalogAlgorithm->getProperty(
"InstrumentList");
59 if (session.size() == sessionIDs.size()) {
61 return catalogAlgorithm->getProperty(
"InvestigationTypes");
63 for (
const auto &sessionID : sessionIDs) {
64 catalogAlgorithm->setProperty(
"Session", sessionID);
67 return catalogAlgorithm->getProperty(
"InvestigationTypes");
82 const int &limit,
const std::vector<std::string> &sessionIDs) {
86 catalogAlgorithm->setProperty(
"Limit", limit);
87 catalogAlgorithm->setProperty(
"Offset", offset);
92 if (session.size() == sessionIDs.size()) {
95 for (
const auto &sessionID : sessionIDs) {
96 catalogAlgorithm->setProperty(
"Session", sessionID);
111 const std::vector<std::string> &sessionIDs) {
114 catalogAlgorithm->setProperty(
"CountOnly",
true);
119 if (session.size() == sessionIDs.size()) {
121 return catalogAlgorithm->getProperty(
"NumberOfSearchResults");
123 for (
const auto &sessionID : sessionIDs) {
124 catalogAlgorithm->setProperty(
"Session", sessionID);
127 return catalogAlgorithm->getProperty(
"NumberOfSearchResults");
140 catalogAlgorithm->setProperty(
"InvestigationId", investigationId);
141 catalogAlgorithm->setPropertyValue(
"OutputWorkspace",
"__dataFileResults");
142 catalogAlgorithm->setProperty(
"Session", sessionID);
156const std::vector<std::string>
158 const std::string &downloadPath,
const std::string &sessionID) {
164 std::vector<int64_t> fileIDs;
165 fileIDs.reserve(userSelectedFiles.size());
166 std::vector<std::string> fileNames;
167 fileNames.reserve(userSelectedFiles.size());
171 for (
const auto &userSelectedFile : userSelectedFiles) {
172 fileIDs.emplace_back(userSelectedFile.first);
173 fileNames.emplace_back(userSelectedFile.second);
179 catalogAlgorithm->setProperty(
"FileIds", fileIDs);
180 catalogAlgorithm->setProperty(
"FileNames", fileNames);
181 catalogAlgorithm->setProperty(
"DownloadPath", downloadPath);
182 catalogAlgorithm->setProperty(
"Session", sessionID);
186 return (catalogAlgorithm->getProperty(
"FileLocations"));
196const std::map<std::string, std::string>
203 std::map<std::string, std::string> errors;
206 for (
const auto &inputField : inputFields) {
208 catalogAlgorithm->setProperty(inputField.first, inputField.second);
209 }
catch (std::invalid_argument &) {
210 std::string documentation =
propertyDocumentation(catalogAlgorithm->getProperties(), inputField.first);
215 errors.emplace(inputField.first +
"_err", documentation);
219 std::string dateField =
"StartDate";
223 dateField =
"EndDate";
226 }
catch (std::invalid_argument &) {
228 errors.emplace(dateField +
"_err", documentation);
240 if (inputDate.empty())
243 std::vector<std::string> dateSegments;
245 boost::algorithm::split_regex(dateSegments, inputDate, boost::regex(
"/"));
247 std::string isoDate = dateSegments.at(2) +
"-" + dateSegments.at(1) +
"-" + dateSegments.at(0) +
" 00:00:00.000";
250 return Mantid::Types::Core::DateAndTime(isoDate).to_time_t();
260 dlg->setModal(
false);
263 dlg->activateWindow();
273 dlg->setModal(
false);
276 dlg->activateWindow();
286 const std::string &name) {
287 for (
auto property : properties) {
288 if (property->name() == name) {
289 return property->documentation();
311 while (!result.available()) {
312 QCoreApplication::processEvents();
323 const std::map<std::string, std::string> &userInputFields) {
326 catalogAlgorithm->setProperty(
"OutputWorkspace",
"__searchResults");
332 for (
const auto &userInputField : userInputFields) {
333 std::string
value = userInputField.second;
335 if (!
value.empty()) {
338 catalogAlgorithm->setProperty(userInputField.first,
value);
double value
The value of the point.
This class is responsible for creating the correct dialog for an algorithm.
AlgorithmDialog * createDialogFromName(const QString &algorithmName, const int version=-1, QWidget *parent=nullptr, bool forScript=false, const QHash< QString, QString > &presetValues=(QHash< QString, QString >()), const QString &optionalMsg=QString(), const QStringList &enabled=QStringList(), const QStringList &disabled=QStringList())
Create an algorithm dialog for a given name and version.
static T & Instance()
Return a reference to the Singleton instance, creating it if it does not already exist Creation is do...
The AlgorithmProgressDialogPresenter keeps track of the running algorithms and displays a progress ba...
std::shared_ptr< IAlgorithm > IAlgorithm_sptr
shared pointer to Mantid::API::IAlgorithm