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 foreach (
auto wsName, wsNames) { vecWsNames.emplace_back(wsName.toStdString()); }
36 alg->setProperty(
"WorkspaceList", vecWsNames);
40 QMessageBox::warning(
nullptr,
"",
"Could not delete selected workspaces.");
46 QString algName(
"RenameWorkspace");
47 if (wsName.size() > 1)
48 algName =
"RenameWorkspaces";
51 if (wsName.size() > 1) {
52 presets[
"InputWorkspaces"] = wsName.join(
",");
54 presets[
"InputWorkspace"] = wsName[0];
65 QString message =
"Cannot create algorithm \"" + algName +
"\"";
67 message +=
" version " + QString::number(version);
69 QMessageBox::warning(
nullptr,
"", message);
83 dlg->activateWindow();
95 alg->setPropertyValue(it.key().toStdString(), it.value().toStdString());
97 }
catch (std::exception &ex) {
98 g_log.
error() <<
"Error setting the properties for algotithm " << algName.toStdString() <<
": " << ex.what()
109 dlg->activateWindow();
121 const std::vector<Mantid::Kernel::Property *> props = alg->getProperties();
122 std::vector<Mantid::Kernel::Property *>::const_iterator p = props.begin();
123 for (; p != props.end(); ++p) {
124 if (!(**p).isDefault()) {
125 QString property_name = QString::fromStdString((**p).name());
126 presets.insert(property_name, QString::fromStdString((**p).value()));
127 enabled.append(property_name);
134 QString optional_msg(alg->summary().c_str());
138 interfaceManager.
createDialog(alg,
nullptr,
false, presets, optional_msg, enabled);
147 while (!result.available()) {
148 QCoreApplication::processEvents();
153 return result.data();
154 }
catch (Poco::NullPointerException &) {
160 }
catch (Poco::NoThreadAvailableException &) {
161 g_log.
error() <<
"No thread was available to run the " << alg->name() <<
" algorithm in the background.\n";
208 int upper,
bool showDlg) {
219 Q_UNUSED(makeVisible);
225 Q_UNUSED(include_data);
231 bool clearWindow,
bool waterfallPlot,
const QString &log,
232 const std::set<double> &customLogValues) {
234 Q_UNUSED(spectrumPlot);
237 Q_UNUSED(plotWindow);
238 Q_UNUSED(clearWindow);
239 Q_UNUSED(waterfallPlot);
241 Q_UNUSED(customLogValues);
255 Q_UNUSED(plotWindow);
261 const std::set<double> &customLogValues,
const QList<QString> &workspaceNames) {
266 Q_UNUSED(customLogValues);
267 Q_UNUSED(workspaceNames);
271 const std::set<double> &customLogValues,
const QList<QString> &workspaceNames) {
276 Q_UNUSED(customLogValues);
277 Q_UNUSED(workspaceNames);
282 bool showTiledOpt,
bool isAdvanced) {
285 Q_UNUSED(showWaterfall);
286 Q_UNUSED(showPlotAll);
287 Q_UNUSED(showTiledOpt);
288 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.
static T & Instance()
Return a reference to the Singleton instance, creating it if it does not already exist Creation is do...
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