Skip to content

Commit

Permalink
Refs #10959 Fix the slice algorithm dialog dimension issue
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonPiccardoSelg committed Jan 27, 2015
1 parent b0be876 commit 06356e1
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Code/Mantid/MantidQt/API/inc/MantidQtAPI/AlgorithmDialog.h
Expand Up @@ -145,6 +145,9 @@ class EXPORT_OPT_MANTIDQT_API AlgorithmDialog : public QDialog
/// Adds a property (name,value) pair to the stored map
void storePropertyValue(const QString & name, const QString & value);

/// Removes a property (name, value) pair from the stored map
void removePropertyValue(const QString& name);

/// Set properties on this algorithm by pulling values from the tied widgets
bool setPropertyValues(const QStringList & skipList = QStringList());
bool setPropertyValue(const QString pName, bool validateOthers);
Expand Down
12 changes: 11 additions & 1 deletion Code/Mantid/MantidQt/API/src/AlgorithmDialog.cpp
Expand Up @@ -263,6 +263,17 @@ void AlgorithmDialog::storePropertyValue(const QString & name, const QString & v
m_propertyValueMap.insert(name, value);
}

//-------------------------------------------------------------------------------------------------
/**
* Adds a property (name,value) pair to the stored map.
* @param name :: The name of the property.
*/
void AlgorithmDialog::removePropertyValue(const QString& name)
{
if( name.isEmpty() ) return;
m_propertyValueMap.remove(name);
}


//-------------------------------------------------------------------------------------------------
/** Show the validators for all the properties */
Expand Down Expand Up @@ -290,7 +301,6 @@ void AlgorithmDialog::showValidators()
}
} // widget is tied
} // for each property

}

//-------------------------------------------------------------------------------------------------
Expand Down
14 changes: 14 additions & 0 deletions Code/Mantid/MantidQt/CustomDialogs/src/SlicingAlgorithmDialog.cpp
Expand Up @@ -278,6 +278,20 @@ namespace MantidQt
void SlicingAlgorithmDialog::makeDimensionInputs(const QString& propertyPrefix,
QLayout* owningLayout, QString (*format)(IMDDimension_const_sptr), History history)
{
// Remove excess dimensions from the tied properties and the stored property values
size_t indexRemoved = 0;
QString propertyNameRemoved = propertyPrefix.copy().append(QString().number(indexRemoved));
Mantid::Kernel::Property *propertyRemoved = getAlgorithmProperty(propertyNameRemoved);

while(propertyRemoved)
{
untie(propertyNameRemoved);
removePropertyValue(propertyNameRemoved);

indexRemoved++;
propertyNameRemoved = propertyPrefix.copy().append(QString().number(indexRemoved));
propertyRemoved = getAlgorithmProperty(propertyNameRemoved);
}

const QString& txt = getCurrentInputWorkspaceName();
if (!txt.isEmpty())
Expand Down

0 comments on commit 06356e1

Please sign in to comment.