12#include <Poco/ActiveResult.h>
14#include <qcoreapplication.h>
18using namespace MantidWidgets;
30 if (!wsNames.isEmpty()) {
32 alg->setLogging(
false);
33 std::vector<std::string> vecWsNames;
34 vecWsNames.reserve(wsNames.size());
35 std::transform(wsNames.cbegin(), wsNames.cend(), std::back_inserter(vecWsNames),
36 [](
const auto &wsName) { return wsName.toStdString(); });
37 alg->setProperty(
"WorkspaceList", vecWsNames);
41 QMessageBox::warning(
nullptr,
"",
"Could not delete selected workspaces.");
47 QString algName(
"RenameWorkspace");
48 if (wsName.size() > 1)
49 algName =
"RenameWorkspaces";
52 if (wsName.size() > 1) {
53 presets[
"InputWorkspaces"] = wsName.join(
",");
55 presets[
"InputWorkspace"] = wsName[0];
64 alg = Mantid::API::AlgorithmManager::Instance().create(algName.toStdString(), version);
66 QString message =
"Cannot create algorithm \"" + algName +
"\"";
68 message +=
" version " + QString::number(version);
70 QMessageBox::warning(
nullptr,
"", message);
84 dlg->activateWindow();
96 alg->setPropertyValue(it.key().toStdString(), it.value().toStdString());
98 }
catch (std::exception &ex) {
99 g_log.
error() <<
"Error setting the properties for algotithm " << algName.toStdString() <<
": " << ex.what()
110 dlg->activateWindow();
122 const std::vector<Mantid::Kernel::Property *> props = alg->getProperties();
123 std::vector<Mantid::Kernel::Property *>::const_iterator p = props.begin();
124 for (; p != props.end(); ++p) {
125 if (!(**p).isDefault()) {
126 QString property_name = QString::fromStdString((**p).name());
127 presets.insert(property_name, QString::fromStdString((**p).value()));
128 enabled.append(property_name);
135 QString optional_msg(alg->summary().c_str());
139 interfaceManager.
createDialog(alg,
nullptr,
false, presets, optional_msg, enabled);
148 while (!result.available()) {
149 QCoreApplication::processEvents();
154 return result.data();
155 }
catch (Poco::NullPointerException &) {
161 }
catch (Poco::NoThreadAvailableException &) {
162 g_log.
error() <<
"No thread was available to run the " << alg->name() <<
" algorithm in the background.\n";
170 if (AnalysisDataService::Instance().doesExist(workspaceName.toStdString())) {
171 return AnalysisDataService::Instance().retrieve(workspaceName.toStdString());
206 int upper,
bool showDlg) {
217 Q_UNUSED(makeVisible);
223 Q_UNUSED(include_data);
229 bool clearWindow,
bool waterfallPlot,
const QString &log,
230 const std::set<double> &customLogValues) {
232 Q_UNUSED(spectrumPlot);
235 Q_UNUSED(plotWindow);
236 Q_UNUSED(clearWindow);
237 Q_UNUSED(waterfallPlot);
239 Q_UNUSED(customLogValues);
253 Q_UNUSED(plotWindow);
259 const std::set<double> &customLogValues,
const QList<QString> &workspaceNames) {
264 Q_UNUSED(customLogValues);
265 Q_UNUSED(workspaceNames);
269 const std::set<double> &customLogValues,
const QList<QString> &workspaceNames) {
274 Q_UNUSED(customLogValues);
275 Q_UNUSED(workspaceNames);
280 bool showTiledOpt,
bool isAdvanced) {
283 Q_UNUSED(showWaterfall);
284 Q_UNUSED(showPlotAll);
285 Q_UNUSED(showTiledOpt);
286 Q_UNUSED(isAdvanced);
IPeaksWorkspace_sptr workspace
double lower
lower and upper bounds on the multiplier, if known
This class should be the basis for all customised algorithm dialogs.
void addAlgorithmObserver(Mantid::API::AlgorithmObserver *observer)
Add an AlgorithmObserver to the algorithm.
This class is responsible for creating the correct dialog for an algorithm.
AlgorithmDialog * createDialog(const std::shared_ptr< Mantid::API::IAlgorithm > &alg, QWidget *parent=nullptr, bool forScript=false, const QHash< QString, QString > &presetValues=(QHash< QString, QString >()), const QString &optional_msg=QString(), const QStringList &enabled=QStringList(), const QStringList &disabled=QStringList())
Create a new instance of the correct type of AlgorithmDialog.
Observes Algorithm notifications: start,progress,finish,error.
The Logger class is in charge of the publishing messages from the framework through various channels.
void error(const std::string &msg)
Logs at error level.
CurveType
Graph curve type.
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
Kernel::Logger g_log("ExperimentInfo")
static logger object
std::shared_ptr< const Workspace > Workspace_const_sptr
shared pointer to Mantid::API::Workspace (const version)
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class