15#include <QIntValidator>
22namespace MantidWidgets {
40 tie(
ui.workspace_selector,
"InputWorkspace",
ui.input_layout);
41 tie(
ui.ck_axis_aligned,
"AxisAligned");
42 tie(
ui.txt_output,
"OutputWorkspace",
ui.output_layout);
43 tie(
ui.txt_output_extents,
"OutputExtents",
ui.output_extents_layout);
44 tie(
ui.txt_output_bins,
"OutputBins",
ui.output_bins_layout);
45 tie(
ui.ck_normalisebasisvectors,
"NormalizeBasisVectors");
46 tie(
ui.ck_force_orthogonal,
"ForceOrthogonal");
47 tie(
ui.txt_translation,
"Translation");
49 ui.txt_memory->setValidator(
new QIntValidator(
this));
50 ui.txt_resursion_depth->setValidator(
new QIntValidator(
this));
59 connect(
ui.ck_max_from_input, SIGNAL(clicked(
bool)),
this, SLOT(
onMaxFromInput(
bool)));
61 connect(
ui.btn_browse, SIGNAL(clicked()),
this, SLOT(
onBrowse()));
62 connect(
ui.btn_help, SIGNAL(clicked()),
this, SLOT(
helpClicked()));
66 ui.workspace_selector->setValidatingAlgorithm(
m_algName);
67 ui.workspace_selector->clear();
69 auto it = names.begin();
70 while (it != names.end()) {
74 ui.workspace_selector->addItem((*it).c_str());
79 int index =
ui.workspace_selector->findText(lastUsedInputWorkspaceName);
81 ui.workspace_selector->setCurrentIndex(
index);
100 QString min, max, nbins, result;
101 QString name(dim->getName().c_str());
102 min.setNum(dim->getMinimum());
103 max.setNum(dim->getMaximum());
104 nbins.setNum(dim->getNBins());
105 result.append(name).append(
",").append(min).append(
",").append(max).append(
",").append(nbins);
133 int itemCount = layout->count();
134 for (
int i = 0; i < itemCount; ++i) {
135 QLayoutItem *pLayoutItem = layout->itemAt(i);
136 QWidget *pWidget = pLayoutItem->widget();
137 if (pWidget !=
nullptr) {
139 auto *propertyLabel =
dynamic_cast<QLabel *
>(pWidget->layout()->itemAt(0)->widget());
140 untie(propertyLabel->text());
141 pWidget->setHidden(
true);
142 this->layout()->removeItem(pLayoutItem);
151 QLayout *alignedLayout = this->
ui.axis_aligned_layout->layout();
152 QLayout *nonAlignedLayout = this->
ui.non_axis_aligned_layout->layout();
192 const QString previousInputWorkspaceName =
194 if (currentWorkspaceName.isEmpty()) {
202 if (oldWS->getNumDims() != newWS->
getNumDims()) {
219 const bool bForceForget) {
221 if (criticalChange ==
HasChanged || bForceForget) {
237 ui.non_axis_aligned_layout->setEnabled(!axisAligned);
265 size_t indexRemoved = 0;
266 QString propertyNameRemoved = propertyPrefix;
267 propertyNameRemoved.append(QString().number(indexRemoved));
270 while (propertyRemoved) {
271 untie(propertyNameRemoved);
275 propertyNameRemoved = propertyPrefix;
276 propertyNameRemoved.append(QString().number(indexRemoved));
281 if (!txt.isEmpty()) {
285 size_t nDimensions = ws->getNumDims();
291 QString propertyName = propertyPrefix;
292 propertyName.append(QString().number(
index));
294 QLabel *dimensionLabel =
new QLabel(propertyName);
297 const QString dimensionInfo = format(dim);
299 auto *txtDimension =
new QLineEdit(dimensionInfo);
302 auto *layout =
new QHBoxLayout;
303 QWidget *w =
new QWidget;
304 w->setLayout(layout);
309 layout->addWidget(dimensionLabel);
310 layout->addWidget(txtDimension);
312 owningLayout->addWidget(w);
320 settings.beginGroup(
"Mantid/SlicingAlgorithm");
330 settings.beginGroup(
"Mantid/SlicingAlgorithm");
332 const bool alwaysCalculateExtents = settings.value(
"AlwaysCalculateExtents", 1).toInt();
333 ui.ck_calculate->setChecked(alwaysCalculateExtents);
356 const bool takeFromInputWorkspace =
ui.ck_max_from_input->isChecked();
357 ui.txt_resursion_depth->setEnabled(!takeFromInputWorkspace);
358 ui.lbl_resursion_depth->setEnabled(!takeFromInputWorkspace);
367 if (
ui.ck_axis_aligned->isChecked())
376 dialog.setDirectory(QDir::homePath());
377 dialog.setNameFilter(
"Nexus files (*.nxs)");
379 ui.txt_filename->setText(dialog.selectedFiles().front());
389 ui.file_backend_layout->setVisible(isSliceMD);
390 ui.ck_max_from_input->setVisible(isSliceMD);
391 ui.lbl_resursion_depth->setVisible(isSliceMD);
392 ui.txt_resursion_depth->setVisible(isSliceMD);
393 ui.ck_parallel->setVisible(!isSliceMD);
409 tie(
ui.ck_max_from_input,
"TakeMaxRecursionDepthFromInput");
410 tie(
ui.txt_resursion_depth,
"MaxRecursionDepth");
411 tie(
ui.txt_filename,
"OutputFilename");
412 tie(
ui.txt_memory,
"Memory");
426 tie(
ui.ck_parallel,
"Parallel");
#define DECLARE_DIALOG(classname)
std::map< DeltaEMode::Type, std::string > index
std::vector< history_type > history
history information
This class should be the basis for all customised algorithm dialogs.
QString m_algName
The name of the algorithm.
virtual void helpClicked()
Help button clicked;.
void removePropertyValue(const QString &name)
Removes a property (name, value) pair from the stored map.
QWidget * tie(QWidget *widget, const QString &property, QLayout *parent_layout=nullptr, bool readHistory=true)
Tie a widget to a property.
Mantid::Kernel::Property * getAlgorithmProperty(const QString &propName) const
Get a pointer to the named property.
void untie(const QString &property)
Untie a widget to a property.
Basic MD Workspace Abstract Class.
virtual size_t getNumDims() const
Base class for properties.
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< IMDEventWorkspace > IMDEventWorkspace_sptr
Shared pointer to Mantid::API::IMDEventWorkspace.
std::shared_ptr< IMDWorkspace > IMDWorkspace_sptr
Shared pointer to the IMDWorkspace base class.
std::shared_ptr< const IMDDimension > IMDDimension_const_sptr
Shared Pointer to const IMDDimension.