Mantid
|
This class should be the basis for all customised algorithm dialogs. More...
#include <AlgorithmDialog.h>
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::Property * | getAlgorithmProperty (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... | |
This class should be the basis for all customised algorithm dialogs.
Definition at line 75 of file AlgorithmDialog.h.
AlgorithmDialog::AlgorithmDialog | ( | QWidget * | parent = nullptr | ) |
DefaultConstructor.
Default Constructor.
Definition at line 48 of file AlgorithmDialog.cpp.
References m_btnTimer.
|
override |
Destructor.
Definition at line 60 of file AlgorithmDialog.cpp.
References m_algorithm, m_observers, m_statusTracked, and Mantid::API::AlgorithmObserver::stopObserving().
|
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().
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.
observer | Pointer to the AlgorithmObserver to add. |
Definition at line 1018 of file AlgorithmDialog.cpp.
References m_observers, and setShowKeepOpen().
Referenced by MantidQt::MantidWidgets::MantidTreeModel::showAlgorithmDialog().
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.
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().
|
protected |
Add the optional message to the given layout.
Add the optional message in a light yellow box to the layout.
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().
|
signal |
Emitted when alg completes and dialog is staying open.
Referenced by errorHandle(), finishHandle(), and initializeLayout().
|
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().
|
overrideprotected |
Only allow close when close is enabled.
Definition at line 1050 of file AlgorithmDialog.cpp.
References closeEventCalled(), and m_exitButton.
|
signal |
Referenced by closeEvent(), and reject().
|
protected |
Create a row layout of buttons with specified text.
Layout the buttons and others in the generic dialog.
Definition at line 626 of file AlgorithmDialog.cpp.
References accept(), createHelpButton(), keepOpenChanged(), m_exitButton, m_keepOpenCheckBox, m_okButton, reject(), and setShowKeepOpen().
Referenced by MantidQt::API::GenericDialog::initLayout(), MantidQt::CustomDialogs::ConvertTableToMatrixWorkspaceDialog::initLayout(), MantidQt::CustomDialogs::FitDialog::initLayout(), MantidQt::CustomDialogs::LoadDAEDialog::initLayout(), MantidQt::CustomDialogs::LoadDialog::initLayout(), MantidQt::CustomDialogs::LoadRawDialog::initLayout(), MantidQt::CustomDialogs::PlotAsymmetryByLogValueDialog::initLayout(), SmoothNeighboursDialog::initLayout(), MantidQt::CustomDialogs::SortTableWorkspaceDialog::initLayout(), and MantidQt::CustomDialogs::StartLiveDataDialog::initLayout().
|
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().
|
protectedslot |
Enable to exit button.
Definition at line 774 of file AlgorithmDialog.cpp.
References m_exitButton.
Referenced by executeAlgorithmAsync().
|
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
alg | Completed algorithm (unused) |
what | the error message (unused) |
Reimplemented from Mantid::API::AlgorithmObserver.
Definition at line 1041 of file AlgorithmDialog.cpp.
References algCompletedSignal(), and UNUSED_ARG.
|
protectedvirtualslot |
Executes the algorithm in a separate thread.
Execute the underlying algorithm.
Definition at line 730 of file AlgorithmDialog.cpp.
References enableExitButton(), Mantid::Kernel::Logger::error(), Mantid::Kernel::DateAndTimeHelpers::g_log, m_algorithm, m_btnTimer, m_exitButton, m_keepOpenCheckBox, m_observers, m_okButton, m_statusTracked, Mantid::API::AlgorithmObserver::observeError(), Mantid::API::AlgorithmObserver::observeFinish(), and Mantid::API::AlgorithmObserver::stopObserving().
Referenced by accept(), MantidQt::API::GenericDialog::accept(), and executeOnAccept().
void AlgorithmDialog::executeOnAccept | ( | bool | on | ) |
If true then execute the algorithm on acceptance.
on | If 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().
|
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
propName | :: The name of the property |
optionsBox | :: A pointer to a QComoboBox object |
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().
|
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.
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().
|
overrideprotectedvirtual |
Handle completion of algorithm started while staying open.
emits another signal to marshal the call to the main ui thread
alg | Completed algorithm (unused) |
Reimplemented from Mantid::API::AlgorithmObserver.
Definition at line 1030 of file AlgorithmDialog.cpp.
References algCompletedSignal(), and UNUSED_ARG.
|
protected |
Flag an input workspace combobox with its property name.
Flag an input workspace widget.
inputWidget | :: A widget used to enter the input workspace |
Definition at line 669 of file AlgorithmDialog.cpp.
References m_inputws_opts.
|
protected |
Get the algorithm pointer.
Definition at line 198 of file AlgorithmDialog.cpp.
References m_algorithm.
Referenced by MantidQt::CustomDialogs::LoadDialog::accept(), MantidQt::CustomDialogs::LoadDialog::createDynamicLayout(), MantidQt::CustomDialogs::FitDialog::domainTypeChanged(), MantidQt::CustomDialogs::LoadDialog::helpClicked(), initializeLayout(), MantidQt::API::GenericDialog::initLayout(), MantidQt::CustomDialogs::LoadDialog::initLayout(), SmoothNeighboursDialog::initLayout(), SmoothNeighboursDialog::inputWorkspaceChanged(), isWidgetEnabled(), MantidQt::CustomDialogs::FitDialog::parseInput(), setOptionalMessage(), setPropertyValue(), and MantidQt::CustomDialogs::InputWorkspaceWidget::setPropertyValue().
|
protected |
Get a pointer to the named property.
Get a named property for this algorithm.
propName | :: The name of the property |
Definition at line 204 of file AlgorithmDialog.cpp.
References m_algorithm, and m_algProperties.
Referenced by fillAndSetComboBox(), fillLineEdit(), MantidQt::CustomDialogs::FitDialog::getAllowedPropertyValues(), getInputValue(), getPreviousValue(), MantidQt::CustomDialogs::LoadRawDialog::initLayout(), isWidgetEnabled(), MantidQt::MantidWidgets::SlicingAlgorithmDialog::makeDimensionInputs(), openFileDialog(), saveInput(), setPreviousValue(), setPropertyValues(), and tie().
|
protected |
Get an input value from the form, dealing with blank inputs etc.
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().
|
protected |
Get the message string.
Return 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().
|
protected |
Get the property value from either the previous input store or from Python argument.
propName | :: Name of the property |
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().
|
protected |
Get a property validator label.
Get or make a property validator label (that little red star)
propname | :: name of the Property |
Definition at line 241 of file AlgorithmDialog.cpp.
References m_noValidation, and m_validators.
Referenced by showValidators(), and tie().
|
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
widget | :: A pointer to the widget |
Definition at line 889 of file AlgorithmDialog.cpp.
References value.
Referenced by parse().
|
protectedvirtualslot |
Help button clicked;.
A slot to handle the help button click.
Definition at line 708 of file AlgorithmDialog.cpp.
References m_algName, m_algorithm, and MantidQt::API::HelpWindow::showAlgorithm().
Referenced by createHelpButton(), MantidQt::MantidWidgets::SlicingAlgorithmDialog::initLayout(), and MantidQt::CustomDialogs::CatalogPublishDialog::initLayout().
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().
|
protectedpure virtual |
This does the work and must be overridden in each deriving class.
Implemented in MantidQt::API::GenericDialog, MantidQt::MantidWidgets::SlicingAlgorithmDialog, MantidQt::CustomDialogs::CatalogPublishDialog, MantidQt::CustomDialogs::ConvertTableToMatrixWorkspaceDialog, MantidQt::CustomDialogs::FitDialog, MantidQt::CustomDialogs::LoadDAEDialog, MantidQt::CustomDialogs::LoadDialog, MantidQt::CustomDialogs::LoadRawDialog, MantidQt::CustomDialogs::LOQScriptInputDialog, MantidQt::CustomDialogs::PlotAsymmetryByLogValueDialog, SmoothNeighboursDialog, MantidQt::CustomDialogs::SortTableWorkspaceDialog, and MantidQt::CustomDialogs::StartLiveDataDialog.
Referenced by initializeLayout().
|
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.
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().
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.
forScript | :: A boolean indicating whether we are being called from a script |
Definition at line 852 of file AlgorithmDialog.cpp.
References m_forScript.
bool AlgorithmDialog::isInitialized | ( | ) | const |
Is this dialog initialized.
Has this dialog been initialized yet.
Definition at line 144 of file AlgorithmDialog.cpp.
References m_isInitialized.
Referenced by initializeLayout().
|
protected |
Is there a message string available.
Definition at line 432 of file AlgorithmDialog.cpp.
References m_strMessage.
Referenced by MantidQt::API::GenericDialog::initLayout(), MantidQt::CustomDialogs::LoadDialog::initLayout(), and MantidQt::CustomDialogs::LoadRawDialog::initLayout().
bool AlgorithmDialog::isShowKeepOpen | ( | ) | const |
Set if the keep open option is shown.
Is the keep open option going to be shown?
Definition at line 85 of file AlgorithmDialog.cpp.
References m_keepOpenCheckBox.
|
protected |
Check is a given property should have its control enabled or not.
Check if the control should be enabled for this property.
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().
|
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().
|
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
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().
|
protected |
Open a file dialog to select many file.
|
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().
|
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().
|
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().
|
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().
|
protected |
Removes a property (name, value) pair from the stored map.
Adds a property (name,value) pair to the stored map.
name | :: The name of the property. |
Definition at line 273 of file AlgorithmDialog.cpp.
References m_propertyValueMap.
Referenced by MantidQt::MantidWidgets::SlicingAlgorithmDialog::makeDimensionInputs().
|
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.
|
protected |
Return a true if the given property requires user input.
propName | :: The name of the property |
Definition at line 215 of file AlgorithmDialog.cpp.
References m_algProperties.
Referenced by MantidQt::CustomDialogs::LoadDialog::createDynamicLayout().
|
protectedvirtual |
Save the input history of an accepted dialog.
Save the property values to the input history.
Reimplemented in MantidQt::CustomDialogs::FitDialog, and MantidQt::CustomDialogs::LoadDialog.
Definition at line 159 of file AlgorithmDialog.cpp.
References getAlgorithmProperty(), Mantid::Kernel::SingletonHolder< T >::Instance(), m_algName, m_algProperties, m_propertyValueMap, Mantid::Kernel::Property::remember(), and value.
Referenced by accept(), MantidQt::API::GenericDialog::accept(), and MantidQt::CustomDialogs::FitDialog::saveInput().
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
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().
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.
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().
void AlgorithmDialog::setPresetValues | ( | const QHash< QString, QString > & | presetValues | ) |
Set a list of suggested values.
Set a list of values for the properties.
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().
|
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
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().
|
protected |
Sets the value of a single property, using the value previously stored using storePropertyValue()
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. |
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().
|
protected |
Set properties on this algorithm by pulling values from the tied widgets.
Set the properties that have been parsed from the dialog.
skipList | :: An optional list of property names whose values will not be set |
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().
void AlgorithmDialog::setShowKeepOpen | ( | const bool | showOption | ) |
Set if the keep open option is shown.
This must be set after calling initializeLayout.
showOption | false to hide the control, otherwise true |
Definition at line 72 of file AlgorithmDialog.cpp.
References m_keepOpenCheckBox.
Referenced by addAlgorithmObserver(), and createDefaultButtonLayout().
|
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().
|
protected |
Adds a property (name,value) pair to the stored map.
Definition at line 262 of file AlgorithmDialog.cpp.
References m_propertyValueMap, and value.
Referenced by MantidQt::CustomDialogs::StartLiveDataDialog::accept(), MantidQt::CustomDialogs::LoadDialog::createDynamicLayout(), MantidQt::CustomDialogs::CatalogPublishDialog::fileSelected(), MantidQt::CustomDialogs::CatalogPublishDialog::initLayout(), parse(), MantidQt::API::GenericDialog::parseInput(), MantidQt::CustomDialogs::FitDialog::parseInput(), MantidQt::CustomDialogs::LOQScriptInputDialog::parseInput(), MantidQt::CustomDialogs::SortTableWorkspaceDialog::parseInput(), MantidQt::CustomDialogs::StartLiveDataDialog::parseInput(), MantidQt::CustomDialogs::FitDialog::saveInput(), setPresetValues(), MantidQt::CustomDialogs::InputWorkspaceWidget::setPropertyValue(), MantidQt::CustomDialogs::CatalogPublishDialog::setSessionProperty(), and MantidQt::CustomDialogs::CatalogPublishDialog::workspaceSelected().
|
protected |
Tie a widget to a property.
Tie together an input widget and a property.
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 |
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().
|
protected |
Untie a widget to a property.
UnTie a property.
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().
|
friend |
Definition at line 117 of file AlgorithmDialog.h.
|
protected |
The name of the algorithm.
Definition at line 271 of file AlgorithmDialog.h.
Referenced by fillAndSetComboBox(), fillLineEdit(), MantidQt::MantidWidgets::SlicingAlgorithmDialog::getHistoricalInputWorkspaceName(), getPreviousValue(), MantidQt::MantidWidgets::SlicingAlgorithmDialog::hasDimensionHistoryChanged(), helpClicked(), MantidQt::MantidWidgets::SlicingAlgorithmDialog::initLayout(), MantidQt::CustomDialogs::CatalogPublishDialog::initLayout(), saveInput(), and setAlgorithm().
|
protected |
The algorithm associated with this dialog.
Definition at line 268 of file AlgorithmDialog.h.
Referenced by executeAlgorithmAsync(), getAlgorithm(), getAlgorithmProperty(), helpClicked(), MantidQt::CustomDialogs::StartLiveDataDialog::initListenerPropLayout(), removeAlgorithmFromManager(), setAlgorithm(), setPropertyValues(), and ~AlgorithmDialog().
|
protected |
The properties associated with this dialog.
Definition at line 273 of file AlgorithmDialog.h.
Referenced by getAlgorithmProperty(), MantidQt::CustomDialogs::StartLiveDataDialog::initListenerPropLayout(), requiresUserInput(), saveInput(), setAlgorithm(), setPropertyValues(), and showValidators().
|
protected |
Flag if the input should be parsed automatically on initialization.
Definition at line 300 of file AlgorithmDialog.h.
Referenced by initializeLayout().
|
protected |
Enable the close button when the timer fires.
Definition at line 330 of file AlgorithmDialog.h.
Referenced by AlgorithmDialog(), and executeAlgorithmAsync().
|
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().
|
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().
|
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().
|
protected |
Definition at line 324 of file AlgorithmDialog.h.
Referenced by closeEvent(), createDefaultButtonLayout(), enableExitButton(), and executeAlgorithmAsync().
|
protected |
A boolean indicating whether this is for a script or not.
Definition at line 282 of file AlgorithmDialog.h.
Referenced by isForScript().
|
protected |
Store a list of the names of input workspace boxes.
Definition at line 313 of file AlgorithmDialog.h.
Referenced by flagInputWS(), and initializeLayout().
|
protected |
Whether the layout has been initialized.
Definition at line 298 of file AlgorithmDialog.h.
Referenced by initializeLayout(), and isInitialized().
|
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().
|
protected |
Definition at line 322 of file AlgorithmDialog.h.
Referenced by createDefaultButtonLayout(), executeAlgorithmAsync(), isShowKeepOpen(), and setShowKeepOpen().
|
protected |
Is the message string empty or not.
Definition at line 295 of file AlgorithmDialog.h.
Referenced by setOptionalMessage().
|
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().
|
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().
|
protected |
Definition at line 324 of file AlgorithmDialog.h.
Referenced by algorithmCompleted(), createDefaultButtonLayout(), MantidQt::CustomDialogs::LoadDialog::disableLoadRequests(), MantidQt::CustomDialogs::LoadDialog::enableLoadRequests(), and executeAlgorithmAsync().
|
protected |
Store a list of output workspace text edits.
Definition at line 316 of file AlgorithmDialog.h.
Referenced by initializeLayout().
|
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().
|
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().
|
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().
|
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().
|
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().
|
protected |
A list of labels to use as validation markers.
Definition at line 303 of file AlgorithmDialog.h.
Referenced by getValidatorMarker(), and setAlgorithm().
|
protected |
A map to keep track of replace workspace button presses.
Definition at line 319 of file AlgorithmDialog.h.
Referenced by initializeLayout().