Mantid
Loading...
Searching...
No Matches
Public Member Functions | Protected Slots | Protected Member Functions | Protected Attributes | Private Types | Private Member Functions | List of all members
MantidQt::MantidWidgets::SlicingAlgorithmDialog Class Referenceabstract

#include <SlicingAlgorithmDialog.h>

Inheritance diagram for MantidQt::MantidWidgets::SlicingAlgorithmDialog:
MantidQt::API::AlgorithmDialog Mantid::API::AlgorithmObserver MantidQt::MantidWidgets::BinMDDialog MantidQt::MantidWidgets::SliceMDDialog

Public Member Functions

 SlicingAlgorithmDialog (QWidget *parent=nullptr)
 Default Constructor. More...
 
 ~SlicingAlgorithmDialog () override
 Destructor. More...
 
- Public Member Functions inherited from MantidQt::API::AlgorithmDialog
 AlgorithmDialog (QWidget *parent=nullptr)
 DefaultConstructor. More...
 
void initializeLayout ()
 Create the layout of the widget. Can only be called once. More...
 
bool isInitialized () const
 Is this dialog initialized. More...
 
bool isShowKeepOpen () const
 Set if the keep open option is shown. More...
 
void setShowKeepOpen (const bool showOption)
 Set if the keep open option is shown. More...
 
 ~AlgorithmDialog () override
 Destructor. More...
 
void setAlgorithm (const Mantid::API::IAlgorithm_sptr &)
 The following methods were made public for testing in GenericDialogDemo.cpp. More...
 
void setPresetValues (const QHash< QString, QString > &presetValues)
 Set a list of suggested values. More...
 
void isForScript (bool forScript)
 Set whether this is intended for use from a script or not. More...
 
void executeOnAccept (bool on)
 If true then execute the algorithm on acceptance. More...
 
void setOptionalMessage (const QString &message)
 Set an optional message to be displayed at the top of the dialog. More...
 
void addEnabledAndDisableLists (const QStringList &enabled, const QStringList &disabled)
 Set comma-separated-list of enabled parameter names. More...
 
void addAlgorithmObserver (Mantid::API::AlgorithmObserver *observer)
 Add an AlgorithmObserver to the algorithm. More...
 

Protected Slots

void onAxisAlignedChanged (bool)
 Event handler for the axis changed event. More...
 
void onBrowse ()
 Handler for the onbrowse event. More...
 
void onCalculateChanged (bool checked)
 
void onMaxFromInput (bool)
 Event handler for changes so that recursion depth for the ouput workspace is either taken from the input workspace or from an external field. More...
 
void onRebuildDimensions ()
 Event handler for the on-forced dimension rebuild event. More...
 
void onWorkspaceChanged ()
 Event handler for the workspace changed event. More...
 
- Protected Slots inherited from MantidQt::API::AlgorithmDialog
void accept () override
 A default slot that can be used for an OK button. More...
 
void reject () override
 A default slot that can be used for a rejected button. More...
 
virtual void helpClicked ()
 Help button clicked;. More...
 
virtual void keepOpenChanged (int state)
 Keep open checkbox clicked;. More...
 
virtual void algorithmCompleted ()
 Keep the running algorithm has completed. More...
 
virtual void executeAlgorithmAsync ()
 Executes the algorithm in a separate thread. More...
 
virtual void removeAlgorithmFromManager ()
 Removes the algorithm from the manager. More...
 
void enableExitButton ()
 Enable to exit button. More...
 

Protected Member Functions

void buildDimensionInputs (const bool bForceForget=false)
 Build dimension inputs. More...
 
void commonSliceMDSetup (const bool)
 Common slice md setup. More...
 
- Protected Member Functions inherited from MantidQt::API::AlgorithmDialog
virtual void parseInput ()
 Parse out the values entered into the dialog boxes. More...
 
virtual void saveInput ()
 Save the input history of an accepted dialog. More...
 
const QString & getOptionalMessage () const
 Get the message string. More...
 
void addOptionalMessage (QVBoxLayout *mainLay)
 Add the optional message to the given layout. More...
 
bool isForScript () const
 Get the usage boolean value. More...
 
bool isMessageAvailable () const
 Is there a message string available. More...
 
bool isWidgetEnabled (const QString &propName) const
 Check is a given property should have its control enabled or not. More...
 
Mantid::API::IAlgorithm_sptr getAlgorithm () const
 Get the algorithm pointer. More...
 
Mantid::Kernel::PropertygetAlgorithmProperty (const QString &propName) const
 Get a pointer to the named property. More...
 
bool requiresUserInput (const QString &propName) const
 Return a true if the given property requires user input. More...
 
QString getInputValue (const QString &propName) const
 Get an input value from the form, dealing with blank inputs etc. More...
 
QLabel * getValidatorMarker (const QString &propname)
 Get a property validator label. More...
 
void storePropertyValue (const QString &name, const QString &value)
 Adds a property (name,value) pair to the stored map. More...
 
void removePropertyValue (const QString &name)
 Removes a property (name, value) pair from the stored map. More...
 
bool setPropertyValues (const QStringList &skipList=QStringList())
 Set properties on this algorithm by pulling values from the tied widgets. More...
 
bool setPropertyValue (const QString &pName, bool validateOthers)
 Sets the value of a single property, using the value previously stored using storePropertyValue() More...
 
void showValidators ()
 Show the validators for all the properties. More...
 
QWidget * tie (QWidget *widget, const QString &property, QLayout *parent_layout=nullptr, bool readHistory=true)
 Tie a widget to a property. More...
 
void untie (const QString &property)
 Untie a widget to a property. More...
 
QString openFileDialog (const QString &propName)
 Open a file dialog to select a file. More...
 
QStringList openMultipleFileDialog (const QString &propName)
 Open a file dialog to select many file. More...
 
void fillAndSetComboBox (const QString &propName, QComboBox *optionsBox) const
 Fill a combo box for the named algorithm's allowed values. More...
 
void fillLineEdit (const QString &propName, QLineEdit *field)
 Fill in the necessary input for a text field. More...
 
QLayout * createDefaultButtonLayout (const QString &helpText=QString("?"), const QString &loadText=QString("Run"), const QString &cancelText=QString("Close"), const QString &keepOpenText=QString("Keep Open"))
 Create a row layout of buttons with specified text. More...
 
QPushButton * createHelpButton (const QString &helpText=QString("?")) const
 Create a help button for this algorithm. More...
 
void flagInputWS (QWidget *inputWidget)
 Flag an input workspace combobox with its property name. More...
 
QString getValue (QWidget *widget)
 Retrieve a text value for a property from a widget. More...
 
void parse ()
 Parse out the input from the dialog. More...
 
bool requestedToKeepEnabled (const QString &propName) const
 Test if the given name's widget has been explicity asked to be enabled. More...
 
QString getPreviousValue (const QString &propName) const
 Get the property value from either the previous input store or from Python argument. More...
 
void setPreviousValue (QWidget *widget, const QString &property)
 Set a value based on any old input that we have. More...
 
void finishHandle (const Mantid::API::IAlgorithm *alg) override
 Handle completion of algorithm started while staying open. More...
 
void errorHandle (const Mantid::API::IAlgorithm *alg, const std::string &what) override
 Handle completion of algorithm started while staying open. More...
 
void closeEvent (QCloseEvent *evt) override
 Only allow close when close is enabled. More...
 

Protected Attributes

Ui::SlicingAlgorithmDialog ui
 view More...
 
- Protected Attributes inherited from MantidQt::API::AlgorithmDialog
Mantid::API::IAlgorithm_sptr m_algorithm
 The algorithm associated with this dialog. More...
 
QString m_algName
 The name of the algorithm. More...
 
QStringList m_algProperties
 The properties associated with this dialog. More...
 
QHash< QString, QString > m_propertyValueMap
 A map of property <name, value> pairs that have been taken from the dialog. More...
 
QHash< QString, QWidget * > m_tied_properties
 A list pointers to the widget for each property. More...
 
bool m_forScript
 A boolean indicating whether this is for a script or not. More...
 
QStringList m_python_arguments
 A list of property names that have been passed from Python. More...
 
QStringList m_enabled
 A list of property names that should have their widgets enabled. More...
 
QStringList m_disabled
 A list of property names that the user has requested to be disabled (overrides those in enabled) More...
 
QString m_strMessage
 The message string to be displayed at the top of the widget; if it exists. More...
 
bool m_keepOpen
 Whether to keep the dialog box open after alg execution. More...
 
bool m_msgAvailable
 Is the message string empty or not. More...
 
bool m_isInitialized
 Whether the layout has been initialized. More...
 
bool m_autoParseOnInit
 Flag if the input should be parsed automatically on initialization. More...
 
QHash< QString, QLabel * > m_validators
 A list of labels to use as validation markers. More...
 
QHash< QString, QString > m_errors
 A map where key = property name; value = the error for this property (i.e. More...
 
QStringList m_noValidation
 A list of property names whose widgets handle their own validation. More...
 
QVector< QWidget * > m_inputws_opts
 Store a list of the names of input workspace boxes. More...
 
QVector< QLineEdit * > m_outputws_fields
 Store a list of output workspace text edits. More...
 
QHash< QPushButton *, int > m_wsbtn_tracker
 A map to keep track of replace workspace button presses. More...
 
QCheckBox * m_keepOpenCheckBox
 
QPushButton * m_okButton
 
QPushButton * m_exitButton
 
std::vector< Mantid::API::AlgorithmObserver * > m_observers
 A list of AlgorithmObservers to add to the algorithm prior to execution. More...
 
QTimer m_btnTimer
 Enable the close button when the timer fires. More...
 
bool m_statusTracked
 A flag to track whether the status of the algorithm is being tracked. More...
 

Private Types

enum  History { Remember , Forget }
 
enum  HistoryChanged { HasChanged , HasNotChanged }
 

Private Member Functions

void cleanLayoutOfDimensions (QLayout *layout)
 Cleans a given layout. More...
 
void clearExistingDimensions ()
 Clear out any exisiting dimension widgets. More...
 
virtual void customiseInitLayout ()=0
 Give base classes the opportunity to do any custom overriding. More...
 
bool doAutoFillDimensions () const
 Do auto fill dimension inputs on changes. More...
 
bool doAxisAligned () const
 Determine if axis aligned or non-axis aligned is required. More...
 
QString getCurrentInputWorkspaceName () const
 Gets the input workspace name provided. More...
 
QString getCurrentOutputWorkspaceName () const
 Gets the output workspace name provided. More...
 
QString getHistoricalInputWorkspaceName () const
 Getter for the historical input workspace name. More...
 
HistoryChanged hasDimensionHistoryChanged () const
 Determine if the dimension history has changed. More...
 
void initLayout () override
 Initialize the layout. More...
 
void loadSettings ()
 Load settings. More...
 
void makeDimensionInputs (const QString &propertyPrefix, QLayout *owningLayout, QString(*format)(const Mantid::Geometry::IMDDimension_const_sptr &), History history)
 Build dimension inputs. More...
 
void saveSettings ()
 Save settings. More...
 
History useHistory (const HistoryChanged &criticalChange, const bool bForceForget)
 Determine if history should be used. More...
 

Additional Inherited Members

- Signals inherited from MantidQt::API::AlgorithmDialog
void algCompletedSignal ()
 Emitted when alg completes and dialog is staying open. More...
 
void closeEventCalled ()
 

Detailed Description

Definition at line 36 of file SlicingAlgorithmDialog.h.

Member Enumeration Documentation

◆ History

Enumerator
Remember 
Forget 

Definition at line 70 of file SlicingAlgorithmDialog.h.

◆ HistoryChanged

Enumerator
HasChanged 
HasNotChanged 

Definition at line 72 of file SlicingAlgorithmDialog.h.

Constructor & Destructor Documentation

◆ SlicingAlgorithmDialog()

MantidQt::MantidWidgets::SlicingAlgorithmDialog::SlicingAlgorithmDialog ( QWidget *  parent = nullptr)

Default Constructor.

Constructor.

Parameters
parent: parent widget

Definition at line 30 of file SlicingAlgorithmDialog.cpp.

◆ ~SlicingAlgorithmDialog()

MantidQt::MantidWidgets::SlicingAlgorithmDialog::~SlicingAlgorithmDialog ( )
override

Destructor.

Definition at line 92 of file SlicingAlgorithmDialog.cpp.

References saveSettings().

Member Function Documentation

◆ buildDimensionInputs()

void MantidQt::MantidWidgets::SlicingAlgorithmDialog::buildDimensionInputs ( const bool  bForceForget = false)
protected

◆ cleanLayoutOfDimensions()

void MantidQt::MantidWidgets::SlicingAlgorithmDialog::cleanLayoutOfDimensions ( QLayout *  layout)
private

Cleans a given layout.

Clears the layout of any qwidget.

Parameters
layout: layout to clean

Definition at line 132 of file SlicingAlgorithmDialog.cpp.

References MantidQt::API::AlgorithmDialog::untie().

Referenced by clearExistingDimensions().

◆ clearExistingDimensions()

void MantidQt::MantidWidgets::SlicingAlgorithmDialog::clearExistingDimensions ( )
private

Clear out any exisiting dimension widgets.

Find existing dimension widgets and get rid of them from the layout.

Definition at line 150 of file SlicingAlgorithmDialog.cpp.

References cleanLayoutOfDimensions(), and ui.

Referenced by buildDimensionInputs().

◆ commonSliceMDSetup()

void MantidQt::MantidWidgets::SlicingAlgorithmDialog::commonSliceMDSetup ( const bool  isSliceMD)
protected

◆ customiseInitLayout()

virtual void MantidQt::MantidWidgets::SlicingAlgorithmDialog::customiseInitLayout ( )
privatepure virtual

Give base classes the opportunity to do any custom overriding.

Implemented in MantidQt::MantidWidgets::SliceMDDialog, and MantidQt::MantidWidgets::BinMDDialog.

Referenced by initLayout().

◆ doAutoFillDimensions()

bool MantidQt::MantidWidgets::SlicingAlgorithmDialog::doAutoFillDimensions ( ) const
private

Do auto fill dimension inputs on changes.

Returns
True if do auto repair.

Definition at line 400 of file SlicingAlgorithmDialog.cpp.

References ui.

Referenced by initLayout(), onAxisAlignedChanged(), onWorkspaceChanged(), and saveSettings().

◆ doAxisAligned()

bool MantidQt::MantidWidgets::SlicingAlgorithmDialog::doAxisAligned ( ) const
private

Determine if axis aligned or non-axis aligned is required.

Determine if the inputs should be in an axis aligned form.

Returns
: True if axis aligned

Definition at line 162 of file SlicingAlgorithmDialog.cpp.

References ui.

Referenced by buildDimensionInputs().

◆ getCurrentInputWorkspaceName()

QString MantidQt::MantidWidgets::SlicingAlgorithmDialog::getCurrentInputWorkspaceName ( ) const
private

Gets the input workspace name provided.

Gets the provided input workspace name.

Returns
name of the input workspace

Definition at line 168 of file SlicingAlgorithmDialog.cpp.

References ui.

Referenced by hasDimensionHistoryChanged(), and makeDimensionInputs().

◆ getCurrentOutputWorkspaceName()

QString MantidQt::MantidWidgets::SlicingAlgorithmDialog::getCurrentOutputWorkspaceName ( ) const
private

Gets the output workspace name provided.

Gets the provided output workspace name.

Returns
name of the output workspace

Definition at line 174 of file SlicingAlgorithmDialog.cpp.

References ui.

◆ getHistoricalInputWorkspaceName()

QString MantidQt::MantidWidgets::SlicingAlgorithmDialog::getHistoricalInputWorkspaceName ( ) const
private

Getter for the historical input workspace name.

Returns
old input workspace name.

Definition at line 180 of file SlicingAlgorithmDialog.cpp.

References Mantid::Kernel::SingletonHolder< T >::Instance(), and MantidQt::API::AlgorithmDialog::m_algName.

Referenced by initLayout().

◆ hasDimensionHistoryChanged()

SlicingAlgorithmDialog::HistoryChanged MantidQt::MantidWidgets::SlicingAlgorithmDialog::hasDimensionHistoryChanged ( ) const
private

Determine if the dimension history has changed.

Determine if properties relating to the dimension history have changed.

Returns
True if it has changed.

Definition at line 188 of file SlicingAlgorithmDialog.cpp.

References getCurrentInputWorkspaceName(), Mantid::API::MDGeometry::getNumDims(), HasChanged, HasNotChanged, Mantid::Kernel::SingletonHolder< T >::Instance(), and MantidQt::API::AlgorithmDialog::m_algName.

Referenced by buildDimensionInputs().

◆ initLayout()

void MantidQt::MantidWidgets::SlicingAlgorithmDialog::initLayout ( )
overrideprivatevirtual

◆ loadSettings()

void MantidQt::MantidWidgets::SlicingAlgorithmDialog::loadSettings ( )
private

Load settings.

Load Settings.

Definition at line 328 of file SlicingAlgorithmDialog.cpp.

References ui.

Referenced by initLayout().

◆ makeDimensionInputs()

void MantidQt::MantidWidgets::SlicingAlgorithmDialog::makeDimensionInputs ( const QString &  propertyPrefix,
QLayout *  owningLayout,
QString(*)(const Mantid::Geometry::IMDDimension_const_sptr &)  format,
History  history 
)
private

Build dimension inputs.

Make dimensions from the currently selected input workspace.

Also fills the inputs with default values.

Parameters
propertyPrefixThe prefix for the property in the algorithm, i.e. AxisAligned.
owningLayoutThe layout that will take ownership of the widgets once generated.
formatfunction pointer to the formatting function
history: Whether to remember of forget property history.

Definition at line 261 of file SlicingAlgorithmDialog.cpp.

References MantidQt::API::AlgorithmDialog::getAlgorithmProperty(), getCurrentInputWorkspaceName(), history, index, Mantid::Kernel::SingletonHolder< T >::Instance(), Remember, MantidQt::API::AlgorithmDialog::removePropertyValue(), MantidQt::API::AlgorithmDialog::tie(), and MantidQt::API::AlgorithmDialog::untie().

Referenced by buildDimensionInputs().

◆ onAxisAlignedChanged

void MantidQt::MantidWidgets::SlicingAlgorithmDialog::onAxisAlignedChanged ( bool  )
protectedslot

Event handler for the axis changed event.

This event handler allows us to continually dynamically provide inputs depending upon the dimensionality.

Definition at line 346 of file SlicingAlgorithmDialog.cpp.

References buildDimensionInputs(), and doAutoFillDimensions().

Referenced by initLayout().

◆ onBrowse

void MantidQt::MantidWidgets::SlicingAlgorithmDialog::onBrowse ( )
protectedslot

Handler for the onbrowse event.

Definition at line 374 of file SlicingAlgorithmDialog.cpp.

References ui.

Referenced by initLayout().

◆ onCalculateChanged

void MantidQt::MantidWidgets::SlicingAlgorithmDialog::onCalculateChanged ( bool  checked)
protectedslot

Definition at line 366 of file SlicingAlgorithmDialog.cpp.

References buildDimensionInputs(), and ui.

Referenced by initLayout().

◆ onMaxFromInput

void MantidQt::MantidWidgets::SlicingAlgorithmDialog::onMaxFromInput ( bool  )
protectedslot

Event handler for changes so that recursion depth for the ouput workspace is either taken from the input workspace or from an external field.

Definition at line 355 of file SlicingAlgorithmDialog.cpp.

References ui.

Referenced by initLayout().

◆ onRebuildDimensions

void MantidQt::MantidWidgets::SlicingAlgorithmDialog::onRebuildDimensions ( )
protectedslot

Event handler for the on-forced dimension rebuild event.

Definition at line 364 of file SlicingAlgorithmDialog.cpp.

References buildDimensionInputs().

Referenced by initLayout().

◆ onWorkspaceChanged

void MantidQt::MantidWidgets::SlicingAlgorithmDialog::onWorkspaceChanged ( )
protectedslot

Event handler for the workspace changed event.

Definition at line 339 of file SlicingAlgorithmDialog.cpp.

References buildDimensionInputs(), and doAutoFillDimensions().

Referenced by initLayout().

◆ saveSettings()

void MantidQt::MantidWidgets::SlicingAlgorithmDialog::saveSettings ( )
private

Save settings.

Save settings for next time.

Definition at line 318 of file SlicingAlgorithmDialog.cpp.

References doAutoFillDimensions().

Referenced by ~SlicingAlgorithmDialog().

◆ useHistory()

SlicingAlgorithmDialog::History MantidQt::MantidWidgets::SlicingAlgorithmDialog::useHistory ( const HistoryChanged criticalChange,
const bool  bForceForget 
)
private

Determine if history should be used.

Parameters
criticalChange: Indicates that the inputs are different in some critical fashion
bForceForget: Force the use of inputworkspace dimensions when configuring the dialog.
Returns
decision about what to do with history, keep it or ignore it.

Definition at line 218 of file SlicingAlgorithmDialog.cpp.

References Forget, HasChanged, history, and Remember.

Referenced by buildDimensionInputs().

Member Data Documentation

◆ ui

Ui::SlicingAlgorithmDialog MantidQt::MantidWidgets::SlicingAlgorithmDialog::ui
protected

The documentation for this class was generated from the following files: