Mantid
Loading...
Searching...
No Matches
Public Member Functions | List of all members
MantidQt::API::AlgorithmDialog Class Referenceabstract

This class should be the basis for all customised algorithm dialogs. More...

#include <AlgorithmDialog.h>

Inheritance diagram for MantidQt::API::AlgorithmDialog:
Mantid::API::AlgorithmObserver MantidQt::API::GenericDialog MantidQt::CustomDialogs::CatalogPublishDialog MantidQt::CustomDialogs::ConvertTableToMatrixWorkspaceDialog MantidQt::CustomDialogs::FitDialog MantidQt::CustomDialogs::LOQScriptInputDialog MantidQt::CustomDialogs::LoadDAEDialog MantidQt::CustomDialogs::LoadDialog MantidQt::CustomDialogs::LoadRawDialog MantidQt::CustomDialogs::PlotAsymmetryByLogValueDialog MantidQt::CustomDialogs::SortTableWorkspaceDialog MantidQt::CustomDialogs::StartLiveDataDialog MantidQt::MantidWidgets::SlicingAlgorithmDialog SmoothNeighboursDialog

Public Member Functions

 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...
 

Protected Member Functions

Virtual functions
virtual void initLayout ()=0
 This does the work and must be overridden in each deriving class. More...
 
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...
 
Dialog information
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...
 

Protected Attributes

Member variables.
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...
 

Algorithm information

class InterfaceManager
 
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...
 

Helper functions

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...
 
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...
 
void algCompletedSignal ()
 Emitted when alg completes and dialog is staying open. More...
 
void closeEventCalled ()
 
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...
 

Additional Inherited Members

- Private Member Functions inherited from Mantid::API::AlgorithmObserver
 AlgorithmObserver ()
 Default constructor. More...
 
 AlgorithmObserver (const IAlgorithm_const_sptr &alg)
 Constructs AlgorithmObserver and connects all its handlers to algorithm alg. More...
 
virtual void errorHandle (const IAlgorithm *alg, const std::string &what)
 
virtual void finishHandle (const IAlgorithm *alg)
 
void observeAll (const IAlgorithm_const_sptr &alg)
 Connect to algorithm alg and observe all its notifications. More...
 
void observeError (const IAlgorithm_const_sptr &alg)
 Connect to algorithm alg and observe its error notification. More...
 
void observeFinish (const IAlgorithm_const_sptr &alg)
 Connect to algorithm alg and observe its finish notification. More...
 
void observeProgress (const IAlgorithm_const_sptr &alg)
 Connect to algorithm alg and observe its progress notification. More...
 
void observeStart (const IAlgorithm_const_sptr &alg)
 Connect to algorithm alg and observe its start notification. More...
 
void observeStarting ()
 Connect to AlgorithmManager and observe its starting notifications. More...
 
virtual void progressHandle (const IAlgorithm *alg, double p, const std::string &msg, const double estimatedTime, const int progressPrecision)
 
virtual void startHandle (const IAlgorithm *alg)
 
virtual void startingHandle (IAlgorithm_sptr alg)
 
void stopObserving (const IAlgorithm_const_sptr &alg)
 Disconnect from algorithm alg. More...
 
void stopObserving (const Mantid::API::IAlgorithm *alg)
 
void stopObservingManager ()
 Disconnect from the algorithm manager. More...
 
virtual ~AlgorithmObserver ()
 Virtual destructor. More...
 

Detailed Description

This class should be the basis for all customised algorithm dialogs.

Author
Martyn Gigg, Tessella Support Services plc
Date
24/02/2009

Definition at line 75 of file AlgorithmDialog.h.

Constructor & Destructor Documentation

◆ AlgorithmDialog()

AlgorithmDialog::AlgorithmDialog ( QWidget *  parent = nullptr)

DefaultConstructor.

Default Constructor.

Definition at line 48 of file AlgorithmDialog.cpp.

References m_btnTimer.

◆ ~AlgorithmDialog()

AlgorithmDialog::~AlgorithmDialog ( )
override

Member Function Documentation

◆ accept

void AlgorithmDialog::accept ( )
overrideprotectedslot

A default slot that can be used for an OK button.

A slot that can be used to connect a button that accepts the dialog if all of the properties are valid.

Definition at line 678 of file AlgorithmDialog.cpp.

References executeAlgorithmAsync(), m_keepOpen, parse(), saveInput(), and setPropertyValues().

Referenced by SmoothNeighboursDialog::accept(), MantidQt::CustomDialogs::StartLiveDataDialog::accept(), and createDefaultButtonLayout().

◆ addAlgorithmObserver()

void AlgorithmDialog::addAlgorithmObserver ( Mantid::API::AlgorithmObserver observer)

Add an AlgorithmObserver to the algorithm.

Observer the execution of the algorithm using an AlgorithmObserver.

All notifications will be observed.

Parameters
observerPointer to the AlgorithmObserver to add.

Definition at line 1018 of file AlgorithmDialog.cpp.

References m_observers, and setShowKeepOpen().

Referenced by MantidQt::MantidWidgets::MantidTreeModel::showAlgorithmDialog().

◆ addEnabledAndDisableLists()

void AlgorithmDialog::addEnabledAndDisableLists ( const QStringList &  enabled,
const QStringList &  disabled 
)

Set comma-separated-list of enabled parameter names.

Set list of enabled and disabled parameter names.

Parameters
enabled,:A list of parameter names to keep enabled
disabled,:A list of parameter names whose widgets should be disabled

Definition at line 822 of file AlgorithmDialog.cpp.

References m_disabled, and m_enabled.

Referenced by MantidQt::API::InterfaceManager::createDialog().

◆ addOptionalMessage()

void AlgorithmDialog::addOptionalMessage ( QVBoxLayout *  mainLay)
protected

Add the optional message to the given layout.

Add the optional message in a light yellow box to the layout.

Parameters
mainLay:: layout

Definition at line 403 of file AlgorithmDialog.cpp.

References getOptionalMessage().

Referenced by MantidQt::API::GenericDialog::initLayout(), MantidQt::CustomDialogs::LoadRawDialog::initLayout(), and SmoothNeighboursDialog::initLayout().

◆ algCompletedSignal

void MantidQt::API::AlgorithmDialog::algCompletedSignal ( )
signal

Emitted when alg completes and dialog is staying open.

Referenced by errorHandle(), finishHandle(), and initializeLayout().

◆ algorithmCompleted

void AlgorithmDialog::algorithmCompleted ( )
protectedvirtualslot

Keep the running algorithm has completed.

Handle completion of algorithm started while staying open.

reenables the OK button when the algorithms finishes.

Definition at line 1067 of file AlgorithmDialog.cpp.

References m_okButton.

Referenced by initializeLayout().

◆ closeEvent()

void AlgorithmDialog::closeEvent ( QCloseEvent *  evt)
overrideprotected

Only allow close when close is enabled.

Definition at line 1050 of file AlgorithmDialog.cpp.

References closeEventCalled(), and m_exitButton.

◆ closeEventCalled

void MantidQt::API::AlgorithmDialog::closeEventCalled ( )
signal

Referenced by closeEvent(), and reject().

◆ createDefaultButtonLayout()

QLayout * AlgorithmDialog::createDefaultButtonLayout ( const QString &  helpText = QString("?"),
const QString &  loadText = QString("Run"),
const QString &  cancelText = QString("Close"),
const QString &  keepOpenText = QString("Keep Open") 
)
protected

◆ createHelpButton()

QPushButton * AlgorithmDialog::createHelpButton ( const QString &  helpText = QString("?")) const
protected

Create a help button for this algorithm.

Create a help button that, when clicked, will open a browser to the Mantid wiki page for that algorithm.

Definition at line 659 of file AlgorithmDialog.cpp.

References helpClicked().

Referenced by createDefaultButtonLayout().

◆ enableExitButton

void AlgorithmDialog::enableExitButton ( )
protectedslot

Enable to exit button.

Definition at line 774 of file AlgorithmDialog.cpp.

References m_exitButton.

Referenced by executeAlgorithmAsync().

◆ errorHandle()

void AlgorithmDialog::errorHandle ( const Mantid::API::IAlgorithm alg,
const std::string &  what 
)
overrideprotectedvirtual

Handle completion of algorithm started while staying open.

Handle error signal of algorithm started while staying open.

emits another signal to marshal the call to the main ui thread

Parameters
algCompleted algorithm (unused)
whatthe error message (unused)

Reimplemented from Mantid::API::AlgorithmObserver.

Definition at line 1041 of file AlgorithmDialog.cpp.

References algCompletedSignal(), and UNUSED_ARG.

◆ executeAlgorithmAsync

void AlgorithmDialog::executeAlgorithmAsync ( )
protectedvirtualslot

◆ executeOnAccept()

void AlgorithmDialog::executeOnAccept ( bool  on)

If true then execute the algorithm on acceptance.

Parameters
onIf true the algorithm is executed when "ok" is pressed

Definition at line 858 of file AlgorithmDialog.cpp.

References executeAlgorithmAsync(), and removeAlgorithmFromManager().

Referenced by MantidQt::API::InterfaceManager::createDialog(), and initializeLayout().

◆ fillAndSetComboBox()

void AlgorithmDialog::fillAndSetComboBox ( const QString &  propName,
QComboBox *  optionsBox 
) const
protected

Fill a combo box for the named algorithm's allowed values.

Takes a combobox and adds the allowed values of the given property to its list.

It also sets the displayed value to the correct one based on either the history or a script input value

Parameters
propName:: The name of the property
optionsBox:: A pointer to a QComoboBox object
Returns
A newed QComboBox

Definition at line 579 of file AlgorithmDialog.cpp.

References getAlgorithmProperty(), index, Mantid::Kernel::SingletonHolder< T >::Instance(), isForScript(), and m_algName.

Referenced by MantidQt::CustomDialogs::ConvertTableToMatrixWorkspaceDialog::initLayout(), MantidQt::CustomDialogs::PlotAsymmetryByLogValueDialog::initLayout(), and MantidQt::CustomDialogs::StartLiveDataDialog::initLayout().

◆ fillLineEdit()

void AlgorithmDialog::fillLineEdit ( const QString &  propName,
QLineEdit *  textField 
)
protected

Fill in the necessary input for a text field.

Set the input for a text box based on either the history or a script value.

Parameters
propName:: The name of the property
textField:: The QLineEdit field

Definition at line 613 of file AlgorithmDialog.cpp.

References getAlgorithmProperty(), Mantid::Kernel::SingletonHolder< T >::Instance(), isForScript(), m_algName, and m_python_arguments.

Referenced by MantidQt::CustomDialogs::LOQScriptInputDialog::initLayout().

◆ finishHandle()

void AlgorithmDialog::finishHandle ( const Mantid::API::IAlgorithm alg)
overrideprotectedvirtual

Handle completion of algorithm started while staying open.

emits another signal to marshal the call to the main ui thread

Parameters
algCompleted algorithm (unused)

Reimplemented from Mantid::API::AlgorithmObserver.

Definition at line 1030 of file AlgorithmDialog.cpp.

References algCompletedSignal(), and UNUSED_ARG.

◆ flagInputWS()

void AlgorithmDialog::flagInputWS ( QWidget *  inputWidget)
protected

Flag an input workspace combobox with its property name.

Flag an input workspace widget.

Parameters
inputWidget:: A widget used to enter the input workspace

Definition at line 669 of file AlgorithmDialog.cpp.

References m_inputws_opts.

◆ getAlgorithm()

Mantid::API::IAlgorithm_sptr AlgorithmDialog::getAlgorithm ( ) const
protected

◆ getAlgorithmProperty()

Mantid::Kernel::Property * AlgorithmDialog::getAlgorithmProperty ( const QString &  propName) const
protected

◆ getInputValue()

QString AlgorithmDialog::getInputValue ( const QString &  propName) const
protected

Get an input value from the form, dealing with blank inputs etc.

Parameters
propName:: The name of the property

Definition at line 222 of file AlgorithmDialog.cpp.

References getAlgorithmProperty(), Mantid::Kernel::Property::getDefault(), m_propertyValueMap, and value.

Referenced by MantidQt::CustomDialogs::ConvertTableToMatrixWorkspaceDialog::initLayout(), and setPropertyValue().

◆ getOptionalMessage()

const QString & AlgorithmDialog::getOptionalMessage ( ) const
protected

Get the message string.

Return the message string.

Returns
the message string

Definition at line 396 of file AlgorithmDialog.cpp.

References m_strMessage.

Referenced by addOptionalMessage(), MantidQt::CustomDialogs::CatalogPublishDialog::initLayout(), and MantidQt::CustomDialogs::LoadDialog::initLayout().

◆ getPreviousValue()

QString AlgorithmDialog::getPreviousValue ( const QString &  propName) const
protected

Get the property value from either the previous input store or from Python argument.

Parameters
propName:: Name of the property
Returns
Previous value. If there is no value, empty string is returned

Definition at line 915 of file AlgorithmDialog.cpp.

References getAlgorithmProperty(), Mantid::Kernel::SingletonHolder< T >::Instance(), isForScript(), m_algName, m_propertyValueMap, and value.

Referenced by MantidQt::CustomDialogs::InputWorkspaceWidget::getStoredPropertyValue(), setPreviousValue(), and MantidQt::CustomDialogs::FitDialog::tieStaticWidgets().

◆ getValidatorMarker()

QLabel * AlgorithmDialog::getValidatorMarker ( const QString &  propname)
protected

Get a property validator label.

Get or make a property validator label (that little red star)

Parameters
propname:: name of the Property
Returns
the QLabel pointer. Will create one if needed.

Definition at line 241 of file AlgorithmDialog.cpp.

References m_noValidation, and m_validators.

Referenced by showValidators(), and tie().

◆ getValue()

QString AlgorithmDialog::getValue ( QWidget *  widget)
protected

Retrieve a text value for a property from a widget.

Get a value from a widget.

The function needs to know about the types of widgets that are being used. Currently it knows about QComboBox, QLineEdit, QCheckBox and FileFinderWidget

Parameters
widget:: A pointer to the widget

Definition at line 889 of file AlgorithmDialog.cpp.

References value.

Referenced by parse().

◆ helpClicked

void AlgorithmDialog::helpClicked ( )
protectedvirtualslot

◆ initializeLayout()

void AlgorithmDialog::initializeLayout ( )

Create the layout of the widget. Can only be called once.

Create the layout for this dialog.

The default is to execute the algorithm when accept() is called. This assumes that the AlgorithmManager owns the algorithm pointer as it must survive after the dialog is destroyed.

Definition at line 100 of file AlgorithmDialog.cpp.

References algCompletedSignal(), algorithmCompleted(), executeOnAccept(), getAlgorithm(), initLayout(), isInitialized(), m_autoParseOnInit, m_inputws_opts, m_isInitialized, m_outputws_fields, m_wsbtn_tracker, parse(), and setPropertyValues().

Referenced by MantidQt::API::InterfaceManager::createDialog().

◆ initLayout()

virtual void MantidQt::API::AlgorithmDialog::initLayout ( )
protectedpure virtual

◆ isForScript() [1/2]

bool AlgorithmDialog::isForScript ( ) const
protected

Get the usage boolean value.

Was this dialog raised from a script? This is important when deciding what to do with properties that have old input.

Returns
A boolean inidcating whether we are being called from a script

Definition at line 426 of file AlgorithmDialog.cpp.

References m_forScript.

Referenced by MantidQt::API::InterfaceManager::createDialog(), fillAndSetComboBox(), fillLineEdit(), MantidQt::CustomDialogs::PlotAsymmetryByLogValueDialog::fillLogBox(), getPreviousValue(), isWidgetEnabled(), and setPreviousValue().

◆ isForScript() [2/2]

void AlgorithmDialog::isForScript ( bool  forScript)

Set whether this is intended for use from a script or not.

Set if we are for a script or not.

Parameters
forScript:: A boolean indicating whether we are being called from a script

Definition at line 852 of file AlgorithmDialog.cpp.

References m_forScript.

◆ isInitialized()

bool AlgorithmDialog::isInitialized ( ) const

Is this dialog initialized.

Has this dialog been initialized yet.

Returns
Whether initialzedLayout has been called yet

Definition at line 144 of file AlgorithmDialog.cpp.

References m_isInitialized.

Referenced by initializeLayout().

◆ isMessageAvailable()

bool AlgorithmDialog::isMessageAvailable ( ) const
protected

◆ isShowKeepOpen()

bool AlgorithmDialog::isShowKeepOpen ( ) const

Set if the keep open option is shown.

Is the keep open option going to be shown?

Returns
true if it will be shown

Definition at line 85 of file AlgorithmDialog.cpp.

References m_keepOpenCheckBox.

◆ isWidgetEnabled()

bool AlgorithmDialog::isWidgetEnabled ( const QString &  propName) const
protected

Check is a given property should have its control enabled or not.

Check if the control should be enabled for this property.

Parameters
propName:: The name of the property

The control is disabled if (1) It is contained in the disabled list or (2) A user passed a value into the dialog

Definition at line 439 of file AlgorithmDialog.cpp.

References getAlgorithm(), getAlgorithmProperty(), isForScript(), m_disabled, m_enabled, and m_python_arguments.

Referenced by MantidQt::CustomDialogs::LoadRawDialog::initLayout(), and tie().

◆ keepOpenChanged

void AlgorithmDialog::keepOpenChanged ( int  state)
protectedvirtualslot

Keep open checkbox clicked;.

A slot to handle the keep open button click.

Definition at line 723 of file AlgorithmDialog.cpp.

References m_keepOpen.

Referenced by createDefaultButtonLayout().

◆ openFileDialog()

QString AlgorithmDialog::openFileDialog ( const QString &  propName)
protected

Open a file dialog to select a file.

Open a file selection box.

The type of dialog, i.e. load/save will depend on the property type

Parameters
propName:: The property name that this is associated with.

Definition at line 562 of file AlgorithmDialog.cpp.

References getAlgorithmProperty(), and MantidQt::API::FilePropertyWidget::openFileDialog().

Referenced by MantidQt::CustomDialogs::LoadRawDialog::browseClicked(), MantidQt::CustomDialogs::LOQScriptInputDialog::browseClicked(), and MantidQt::CustomDialogs::PlotAsymmetryByLogValueDialog::openFileDialog().

◆ openMultipleFileDialog()

QStringList MantidQt::API::AlgorithmDialog::openMultipleFileDialog ( const QString &  propName)
protected

Open a file dialog to select many file.

◆ parse()

void AlgorithmDialog::parse ( )
protected

Parse out the input from the dialog.

Parse out information from the dialog.

Definition at line 782 of file AlgorithmDialog.cpp.

References getValue(), m_tied_properties, parseInput(), and storePropertyValue().

Referenced by accept(), MantidQt::API::GenericDialog::accept(), and initializeLayout().

◆ parseInput()

void AlgorithmDialog::parseInput ( )
protectedvirtual

Parse out the values entered into the dialog boxes.

Parse input from widgets on the dialog.

Use storePropertyValue() to store the <name, value> pair in the base class so that they can be retrieved later

This function does nothing in the base class

Reimplemented in MantidQt::API::GenericDialog, MantidQt::CustomDialogs::FitDialog, MantidQt::CustomDialogs::LOQScriptInputDialog, MantidQt::CustomDialogs::SortTableWorkspaceDialog, and MantidQt::CustomDialogs::StartLiveDataDialog.

Definition at line 153 of file AlgorithmDialog.cpp.

Referenced by parse().

◆ reject

void AlgorithmDialog::reject ( )
overrideprotectedslot

A default slot that can be used for a rejected button.

Definition at line 698 of file AlgorithmDialog.cpp.

References closeEventCalled().

Referenced by createDefaultButtonLayout(), and MantidQt::CustomDialogs::CatalogPublishDialog::initLayout().

◆ removeAlgorithmFromManager

void AlgorithmDialog::removeAlgorithmFromManager ( )
protectedvirtualslot

Removes the algorithm from the manager.

Definition at line 769 of file AlgorithmDialog.cpp.

References Mantid::Kernel::SingletonHolder< T >::Instance(), and m_algorithm.

Referenced by executeOnAccept().

◆ removePropertyValue()

void AlgorithmDialog::removePropertyValue ( const QString &  name)
protected

Removes a property (name, value) pair from the stored map.

Adds a property (name,value) pair to the stored map.

Parameters
name:: The name of the property.

Definition at line 273 of file AlgorithmDialog.cpp.

References m_propertyValueMap.

Referenced by MantidQt::MantidWidgets::SlicingAlgorithmDialog::makeDimensionInputs().

◆ requestedToKeepEnabled()

bool AlgorithmDialog::requestedToKeepEnabled ( const QString &  propName) const
protected

Test if the given name's widget has been explicity asked to be enabled.

Returns true if the parameter name has been explicity requested to be kept enabled.

If the parameter has been explicity requested to be disabled then return false as well as if neither have been specified

Definition at line 834 of file AlgorithmDialog.cpp.

References m_disabled, and m_enabled.

◆ requiresUserInput()

bool AlgorithmDialog::requiresUserInput ( const QString &  propName) const
protected

Return a true if the given property requires user input.

Parameters
propName:: The name of the property

Definition at line 215 of file AlgorithmDialog.cpp.

References m_algProperties.

Referenced by MantidQt::CustomDialogs::LoadDialog::createDynamicLayout().

◆ saveInput()

void AlgorithmDialog::saveInput ( )
protectedvirtual

◆ setAlgorithm()

void AlgorithmDialog::setAlgorithm ( const Mantid::API::IAlgorithm_sptr alg)

The following methods were made public for testing in GenericDialogDemo.cpp.

Set the algorithm pointer.

Set the algorithm associated with this dialog

Parameters
alg:: A pointer to the algorithm

Definition at line 177 of file AlgorithmDialog.cpp.

References Mantid::Kernel::Property::direction(), m_algName, m_algorithm, m_algProperties, m_noValidation, m_tied_properties, m_validators, Mantid::Kernel::Property::name(), and Mantid::Kernel::Direction::Output.

Referenced by MantidQt::API::InterfaceManager::createDialog(), and MantidQt::CustomDialogs::LoadDialog::createDynamicLayout().

◆ setOptionalMessage()

void AlgorithmDialog::setOptionalMessage ( const QString &  message)

Set an optional message to be displayed at the top of the dialog.

Set an optional message to be displayed at the top of the widget.

Parameters
message:: The message string

Definition at line 871 of file AlgorithmDialog.cpp.

References getAlgorithm(), m_msgAvailable, and m_strMessage.

Referenced by MantidQt::API::InterfaceManager::createDialog(), and MantidQt::CustomDialogs::CatalogPublishDialog::populateUserInvestigations().

◆ setPresetValues()

void AlgorithmDialog::setPresetValues ( const QHash< QString, QString > &  presetValues)

Set a list of suggested values.

Set a list of values for the properties.

Parameters
presetValues:: A string containing a list of "name=value" pairs with each separated by an '|' character

Definition at line 801 of file AlgorithmDialog.cpp.

References m_python_arguments, setPropertyValues(), storePropertyValue(), and value.

Referenced by MantidQt::API::InterfaceManager::createDialog().

◆ setPreviousValue()

void AlgorithmDialog::setPreviousValue ( QWidget *  widget,
const QString &  propName 
)
protected

Set a value based on any old input that we have.

Set a value for a widget.

The function needs to know about the types of widgets that are being used. Currently it knows about QComboBox, QLineEdit and QCheckBox

Parameters
widget:: A pointer to the widget
propName:: The property name

Definition at line 938 of file AlgorithmDialog.cpp.

References getAlgorithmProperty(), getPreviousValue(), index, isForScript(), m_python_arguments, MantidQt::API::PropertyWidget::setPreviousValue(), MantidQt::API::MantidWidget::setUserInput(), value, and Mantid::Kernel::DateAndTimeHelpers::verifyAndSanitizeISO8601().

Referenced by MantidQt::API::GenericDialog::initLayout(), and tie().

◆ setPropertyValue()

bool AlgorithmDialog::setPropertyValue ( const QString &  pName,
bool  validateOthers 
)
protected

Sets the value of a single property, using the value previously stored using storePropertyValue()

Parameters
pName:: name of the property to set
validateOthers:: set to true to validate, enable, or hide ALL other properties after. Set false if you are setting ALL property values and do it once at the end.
Returns
true if the property is valid.

Definition at line 316 of file AlgorithmDialog.cpp.

References error, getAlgorithm(), getInputValue(), m_errors, showValidators(), and value.

Referenced by MantidQt::CustomDialogs::CatalogPublishDialog::fileSelected(), setPropertyValues(), and MantidQt::CustomDialogs::CatalogPublishDialog::workspaceSelected().

◆ setPropertyValues()

bool AlgorithmDialog::setPropertyValues ( const QStringList &  skipList = QStringList())
protected

Set properties on this algorithm by pulling values from the tied widgets.

Set the properties that have been parsed from the dialog.

Parameters
skipList:: An optional list of property names whose values will not be set
Returns
A boolean that indicates if the validation was successful.

Definition at line 345 of file AlgorithmDialog.cpp.

References error, getAlgorithmProperty(), Mantid::Kernel::Property::isValid(), m_algorithm, m_algProperties, m_errors, setPropertyValue(), showValidators(), and value.

Referenced by accept(), MantidQt::API::GenericDialog::accept(), MantidQt::CustomDialogs::LoadDialog::createDynamicLayout(), initializeLayout(), setPresetValues(), and MantidQt::CustomDialogs::FitDialog::workspaceChanged().

◆ setShowKeepOpen()

void AlgorithmDialog::setShowKeepOpen ( const bool  showOption)

Set if the keep open option is shown.

This must be set after calling initializeLayout.

Parameters
showOptionfalse to hide the control, otherwise true

Definition at line 72 of file AlgorithmDialog.cpp.

References m_keepOpenCheckBox.

Referenced by addAlgorithmObserver(), and createDefaultButtonLayout().

◆ showValidators()

void AlgorithmDialog::showValidators ( )
protected

Show the validators for all the properties.

Definition at line 281 of file AlgorithmDialog.cpp.

References error, getValidatorMarker(), m_algProperties, m_errors, and m_tied_properties.

Referenced by setPropertyValue(), and setPropertyValues().

◆ storePropertyValue()

void AlgorithmDialog::storePropertyValue ( const QString &  name,
const QString &  value 
)
protected

◆ tie()

QWidget * AlgorithmDialog::tie ( QWidget *  widget,
const QString &  property,
QLayout *  parent_layout = nullptr,
bool  readHistory = true 
)
protected

Tie a widget to a property.

Tie together an input widget and a property.

Parameters
widget:: The widget that will collect the input
property:: The name of the property to tie the given widget to
parent_layout:: An optional pointer to a QLayout class that is reponsible for managing the passed widget. If given, a validator label will be added for the given input widget
readHistory:: If true then a history value will be retrieved
Returns
A NULL pointer if a valid label was successfully add to a passed parent_layout otherwise it returns a pointer to the QLabel instance marking the validity

Definition at line 497 of file AlgorithmDialog.cpp.

References Mantid::Kernel::Property::documentation(), getAlgorithmProperty(), MantidQt::API::PropertyWidget::getMainWidget(), getValidatorMarker(), isWidgetEnabled(), m_noValidation, m_tied_properties, MantidQt::API::PropertyWidget::setFieldPlaceholderText(), and setPreviousValue().

Referenced by MantidQt::CustomDialogs::LoadDialog::createWidgetsForProperty(), MantidQt::MantidWidgets::SliceMDDialog::customiseInitLayout(), MantidQt::MantidWidgets::BinMDDialog::customiseInitLayout(), MantidQt::MantidWidgets::SlicingAlgorithmDialog::initLayout(), MantidQt::CustomDialogs::CatalogPublishDialog::initLayout(), MantidQt::CustomDialogs::ConvertTableToMatrixWorkspaceDialog::initLayout(), MantidQt::CustomDialogs::LoadDAEDialog::initLayout(), MantidQt::CustomDialogs::LoadRawDialog::initLayout(), MantidQt::CustomDialogs::PlotAsymmetryByLogValueDialog::initLayout(), SmoothNeighboursDialog::initLayout(), MantidQt::CustomDialogs::StartLiveDataDialog::initLayout(), MantidQt::CustomDialogs::StartLiveDataDialog::initListenerPropLayout(), MantidQt::MantidWidgets::SlicingAlgorithmDialog::makeDimensionInputs(), MantidQt::CustomDialogs::FitDialog::tieStaticWidgets(), MantidQt::CustomDialogs::LoadDialog::tieStaticWidgets(), and MantidQt::CustomDialogs::SortTableWorkspaceDialog::tieStaticWidgets().

◆ untie()

void AlgorithmDialog::untie ( const QString &  property)
protected

Untie a widget to a property.

UnTie a property.

Parameters
property:: The name of the property to tie the given widget to

Definition at line 477 of file AlgorithmDialog.cpp.

References m_tied_properties.

Referenced by MantidQt::MantidWidgets::SlicingAlgorithmDialog::cleanLayoutOfDimensions(), and MantidQt::MantidWidgets::SlicingAlgorithmDialog::makeDimensionInputs().

Friends And Related Function Documentation

◆ InterfaceManager

friend class InterfaceManager
friend

Definition at line 117 of file AlgorithmDialog.h.

Member Data Documentation

◆ m_algName

QString MantidQt::API::AlgorithmDialog::m_algName
protected

◆ m_algorithm

Mantid::API::IAlgorithm_sptr MantidQt::API::AlgorithmDialog::m_algorithm
protected

◆ m_algProperties

QStringList MantidQt::API::AlgorithmDialog::m_algProperties
protected

◆ m_autoParseOnInit

bool MantidQt::API::AlgorithmDialog::m_autoParseOnInit
protected

Flag if the input should be parsed automatically on initialization.

Definition at line 300 of file AlgorithmDialog.h.

Referenced by initializeLayout().

◆ m_btnTimer

QTimer MantidQt::API::AlgorithmDialog::m_btnTimer
protected

Enable the close button when the timer fires.

Definition at line 330 of file AlgorithmDialog.h.

Referenced by AlgorithmDialog(), and executeAlgorithmAsync().

◆ m_disabled

QStringList MantidQt::API::AlgorithmDialog::m_disabled
protected

A list of property names that the user has requested to be disabled (overrides those in enabled)

Definition at line 289 of file AlgorithmDialog.h.

Referenced by addEnabledAndDisableLists(), MantidQt::API::GenericDialog::initLayout(), SmoothNeighboursDialog::initLayout(), isWidgetEnabled(), and requestedToKeepEnabled().

◆ m_enabled

QStringList MantidQt::API::AlgorithmDialog::m_enabled
protected

A list of property names that should have their widgets enabled.

Definition at line 286 of file AlgorithmDialog.h.

Referenced by addEnabledAndDisableLists(), MantidQt::API::GenericDialog::initLayout(), SmoothNeighboursDialog::initLayout(), isWidgetEnabled(), and requestedToKeepEnabled().

◆ m_errors

QHash<QString, QString> MantidQt::API::AlgorithmDialog::m_errors
protected

A map where key = property name; value = the error for this property (i.e.

it is not valid).

Definition at line 307 of file AlgorithmDialog.h.

Referenced by MantidQt::API::GenericDialog::accept(), SmoothNeighboursDialog::accept(), setPropertyValue(), setPropertyValues(), and showValidators().

◆ m_exitButton

QPushButton * MantidQt::API::AlgorithmDialog::m_exitButton
protected

◆ m_forScript

bool MantidQt::API::AlgorithmDialog::m_forScript
protected

A boolean indicating whether this is for a script or not.

Definition at line 282 of file AlgorithmDialog.h.

Referenced by isForScript().

◆ m_inputws_opts

QVector<QWidget *> MantidQt::API::AlgorithmDialog::m_inputws_opts
protected

Store a list of the names of input workspace boxes.

Definition at line 313 of file AlgorithmDialog.h.

Referenced by flagInputWS(), and initializeLayout().

◆ m_isInitialized

bool MantidQt::API::AlgorithmDialog::m_isInitialized
protected

Whether the layout has been initialized.

Definition at line 298 of file AlgorithmDialog.h.

Referenced by initializeLayout(), and isInitialized().

◆ m_keepOpen

bool MantidQt::API::AlgorithmDialog::m_keepOpen
protected

Whether to keep the dialog box open after alg execution.

Definition at line 293 of file AlgorithmDialog.h.

Referenced by accept(), MantidQt::API::GenericDialog::accept(), and keepOpenChanged().

◆ m_keepOpenCheckBox

QCheckBox* MantidQt::API::AlgorithmDialog::m_keepOpenCheckBox
protected

◆ m_msgAvailable

bool MantidQt::API::AlgorithmDialog::m_msgAvailable
protected

Is the message string empty or not.

Definition at line 295 of file AlgorithmDialog.h.

Referenced by setOptionalMessage().

◆ m_noValidation

QStringList MantidQt::API::AlgorithmDialog::m_noValidation
protected

A list of property names whose widgets handle their own validation.

Definition at line 310 of file AlgorithmDialog.h.

Referenced by getValidatorMarker(), setAlgorithm(), and tie().

◆ m_observers

std::vector<Mantid::API::AlgorithmObserver *> MantidQt::API::AlgorithmDialog::m_observers
protected

A list of AlgorithmObservers to add to the algorithm prior to execution.

Definition at line 327 of file AlgorithmDialog.h.

Referenced by addAlgorithmObserver(), executeAlgorithmAsync(), and ~AlgorithmDialog().

◆ m_okButton

QPushButton* MantidQt::API::AlgorithmDialog::m_okButton
protected

◆ m_outputws_fields

QVector<QLineEdit *> MantidQt::API::AlgorithmDialog::m_outputws_fields
protected

Store a list of output workspace text edits.

Definition at line 316 of file AlgorithmDialog.h.

Referenced by initializeLayout().

◆ m_propertyValueMap

QHash<QString, QString> MantidQt::API::AlgorithmDialog::m_propertyValueMap
protected

A map of property <name, value> pairs that have been taken from the dialog.

Definition at line 276 of file AlgorithmDialog.h.

Referenced by getInputValue(), getPreviousValue(), removePropertyValue(), saveInput(), and storePropertyValue().

◆ m_python_arguments

QStringList MantidQt::API::AlgorithmDialog::m_python_arguments
protected

A list of property names that have been passed from Python.

Definition at line 284 of file AlgorithmDialog.h.

Referenced by fillLineEdit(), MantidQt::API::GenericDialog::initLayout(), SmoothNeighboursDialog::initLayout(), isWidgetEnabled(), setPresetValues(), and setPreviousValue().

◆ m_statusTracked

bool MantidQt::API::AlgorithmDialog::m_statusTracked
protected

A flag to track whether the status of the algorithm is being tracked.

Definition at line 332 of file AlgorithmDialog.h.

Referenced by executeAlgorithmAsync(), and ~AlgorithmDialog().

◆ m_strMessage

QString MantidQt::API::AlgorithmDialog::m_strMessage
protected

The message string to be displayed at the top of the widget; if it exists.

Definition at line 291 of file AlgorithmDialog.h.

Referenced by getOptionalMessage(), isMessageAvailable(), and setOptionalMessage().

◆ m_tied_properties

QHash<QString, QWidget *> MantidQt::API::AlgorithmDialog::m_tied_properties
protected

A list pointers to the widget for each property.

Definition at line 279 of file AlgorithmDialog.h.

Referenced by MantidQt::CustomDialogs::PlotAsymmetryByLogValueDialog::openFileDialog(), parse(), setAlgorithm(), showValidators(), tie(), and untie().

◆ m_validators

QHash<QString, QLabel *> MantidQt::API::AlgorithmDialog::m_validators
protected

A list of labels to use as validation markers.

Definition at line 303 of file AlgorithmDialog.h.

Referenced by getValidatorMarker(), and setAlgorithm().

◆ m_wsbtn_tracker

QHash<QPushButton *, int> MantidQt::API::AlgorithmDialog::m_wsbtn_tracker
protected

A map to keep track of replace workspace button presses.

Definition at line 319 of file AlgorithmDialog.h.

Referenced by initializeLayout().


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