|
Mantid
|
This class gives specialised dialog for the Load algorithm. More...
#include <LoadDialog.h>
Public Member Functions | |
| LoadDialog (QWidget *parent=nullptr) | |
| Default constructor. | |
Public Member Functions inherited from MantidQt::API::AlgorithmDialog | |
| AlgorithmDialog (QWidget *parent=nullptr) | |
| DefaultConstructor. | |
| void | initializeLayout () |
| Create the layout of the widget. Can only be called once. | |
| bool | isInitialized () const |
| Is this dialog initialized. | |
| bool | isShowKeepOpen () const |
| Set if the keep open option is shown. | |
| void | setShowKeepOpen (const bool showOption) |
| Set if the keep open option is shown. | |
| ~AlgorithmDialog () override | |
| Destructor. | |
| void | setAlgorithm (const Mantid::API::IAlgorithm_sptr &) |
| The following methods were made public for testing in GenericDialogDemo.cpp. | |
| void | setPresetValues (const QHash< QString, QString > &presetValues) |
| Set a list of suggested values. | |
| void | isForScript (bool forScript) |
| Set whether this is intended for use from a script or not. | |
| void | executeOnAccept (bool on) |
| If true then execute the algorithm on acceptance. | |
| void | setOptionalMessage (const QString &message) |
| Set an optional message to be displayed at the top of the dialog. | |
| void | addEnabledAndDisableLists (const QStringList &enabled, const QStringList &disabled) |
| Set comma-separated-list of enabled parameter names. | |
| void | addAlgorithmObserver (Mantid::API::AlgorithmObserver *observer) |
| Add an AlgorithmObserver to the algorithm. | |
| void | disableExitButton () |
| Disable the exit button. | |
Private Slots | |
| void | accept () override |
| Override accept() slot. | |
| void | createDynamicWidgets () |
| Create the widgets and layouts that are dynamic, i.e they depend on the specific load algorithm. | |
| void | enableNameSuggestion (const bool on=false) |
| Connect/Disconnect the signal that updates the workspace name with a suggested value. | |
| void | helpClicked () override |
| Override the help button clicked method. | |
| void | resultInspectionFinished () |
| Accept the load dialog when user input is inspected and is valid. | |
| void | suggestWSName () |
| Suggest a workspace name from the file. | |
Private Member Functions | |
| void | createDynamicLayout () |
| Create. | |
| int | createWidgetsForProperty (const Mantid::Kernel::Property *prop, QVBoxLayout *propertyLayout, QWidget *parent) |
| Create the widgets for a given property. | |
| void | initLayout () override |
| Initialize the layout. | |
| void | removeOldInputWidgets (QVBoxLayout *layout) |
| Clears all of the widgets from the old layout. | |
| void | saveInput () override |
| Save the input history. | |
| void | tieStaticWidgets (const bool readHistory) |
| Tie static widgets to their properties. | |
Private Attributes | |
| QString | m_currentFiles |
| The current file. | |
| Ui::LoadDialog | m_form |
| Form. | |
| int | m_initialHeight |
| The initial height. | |
| bool | m_populating |
| Flag to indicating if we are populating the dialog. | |
| bool | m_userAccept |
| Flag to indicate the user accepted the load dialog. | |
Additional Inherited Members | |
Signals inherited from MantidQt::API::AlgorithmDialog | |
| void | algCompletedSignal () |
| Emitted when alg completes and dialog is staying open. | |
| void | closeEventCalled () |
Protected Slots inherited from MantidQt::API::AlgorithmDialog | |
| void | accept () override |
| A default slot that can be used for an OK button. | |
| void | reject () override |
| A default slot that can be used for a rejected button. | |
| virtual void | helpClicked () |
| Help button clicked;. | |
| virtual void | keepOpenChanged (int state) |
| Keep open checkbox clicked;. | |
| virtual void | algorithmCompleted () |
| Keep the running algorithm has completed. | |
| virtual void | executeAlgorithmAsync () |
| Executes the algorithm in a separate thread. | |
| virtual void | removeAlgorithmFromManager () |
| Removes the algorithm from the manager. | |
| void | enableExitButton () |
| Enable to exit button. | |
Protected Member Functions inherited from MantidQt::API::AlgorithmDialog | |
| virtual void | parseInput () |
| Parse out the values entered into the dialog boxes. | |
| const QString & | getOptionalMessage () const |
| Get the message string. | |
| void | addOptionalMessage (QVBoxLayout *mainLay) |
| Add the optional message to the given layout. | |
| bool | isForScript () const |
| Get the usage boolean value. | |
| bool | isMessageAvailable () const |
| Is there a message string available. | |
| bool | isWidgetEnabled (const QString &propName) const |
| Check is a given property should have its control enabled or not. | |
| Mantid::API::IAlgorithm_sptr | getAlgorithm () const |
| Get the algorithm pointer. | |
| Mantid::Kernel::Property * | getAlgorithmProperty (const QString &propName) const |
| Get a pointer to the named property. | |
| bool | requiresUserInput (const QString &propName) const |
| Return a true if the given property requires user input. | |
| QString | getInputValue (const QString &propName) const |
| Get an input value from the form, dealing with blank inputs etc. | |
| QLabel * | getValidatorMarker (const QString &propname) |
| Get a property validator label. | |
| void | storePropertyValue (const QString &name, const QString &value) |
| Adds a property (name,value) pair to the stored map. | |
| void | removePropertyValue (const QString &name) |
| Removes a property (name, value) pair from the stored map. | |
| bool | setPropertyValues (const QStringList &skipList=QStringList()) |
| Set properties on this algorithm by pulling values from the tied widgets. | |
| bool | setPropertyValue (const QString &pName, bool validateOthers) |
| Sets the value of a single property, using the value previously stored using storePropertyValue() | |
| void | showValidators () |
| Show the validators for all the properties. | |
| QWidget * | tie (QWidget *widget, const QString &property, QLayout *parent_layout=nullptr, bool readHistory=true) |
| Tie a widget to a property. | |
| void | untie (const QString &property) |
| Untie a widget to a property. | |
| QString | openFileDialog (const QString &propName) |
| Open a file dialog to select a file. | |
| QStringList | openMultipleFileDialog (const QString &propName) |
| Open a file dialog to select many file. | |
| void | fillAndSetComboBox (const QString &propName, QComboBox *optionsBox) const |
| Fill a combo box for the named algorithm's allowed values. | |
| void | fillLineEdit (const QString &propName, QLineEdit *field) |
| Fill in the necessary input for a text field. | |
| 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. | |
| QPushButton * | createHelpButton (const QString &helpText=QString("?")) const |
| Create a help button for this algorithm. | |
| void | flagInputWS (QWidget *inputWidget) |
| Flag an input workspace combobox with its property name. | |
| QString | getValue (QWidget *widget) |
| Retrieve a text value for a property from a widget. | |
| void | parse () |
| Parse out the input from the dialog. | |
| bool | requestedToKeepEnabled (const QString &propName) const |
| Test if the given name's widget has been explicity asked to be enabled. | |
| QString | getPreviousValue (const QString &propName) const |
| Get the property value from either the previous input store or from Python argument. | |
| void | setPreviousValue (QWidget *widget, const QString &property) |
| Set a value based on any old input that we have. | |
| void | finishHandle (const Mantid::API::IAlgorithm *alg) override |
| Handle completion of algorithm started while staying open. | |
| void | errorHandle (const Mantid::API::IAlgorithm *alg, const std::string &what) override |
| Handle completion of algorithm started while staying open. | |
| void | closeEvent (QCloseEvent *evt) override |
| Only allow close when close is enabled. | |
Protected Attributes inherited from MantidQt::API::AlgorithmDialog | |
| Mantid::API::IAlgorithm_sptr | m_algorithm |
| The algorithm associated with this dialog. | |
| QString | m_algName |
| The name of the algorithm. | |
| QStringList | m_algProperties |
| The properties associated with this dialog. | |
| QHash< QString, QString > | m_propertyValueMap |
| A map of property <name, value> pairs that have been taken from the dialog. | |
| QHash< QString, QWidget * > | m_tied_properties |
| A list pointers to the widget for each property. | |
| bool | m_forScript |
| A boolean indicating whether this is for a script or not. | |
| QStringList | m_python_arguments |
| A list of property names that have been passed from Python. | |
| QStringList | m_enabled |
| A list of property names that should have their widgets enabled. | |
| QStringList | m_disabled |
| A list of property names that the user has requested to be disabled (overrides those in enabled) | |
| QString | m_strMessage |
| The message string to be displayed at the top of the widget; if it exists. | |
| bool | m_keepOpen |
| Whether to keep the dialog box open after alg execution. | |
| bool | m_msgAvailable |
| Is the message string empty or not. | |
| bool | m_isInitialized |
| Whether the layout has been initialized. | |
| bool | m_autoParseOnInit |
| Flag if the input should be parsed automatically on initialization. | |
| QHash< QString, QLabel * > | m_validators |
| A list of labels to use as validation markers. | |
| QHash< QString, QString > | m_errors |
| A map where key = property name; value = the error for this property (i.e. | |
| QStringList | m_noValidation |
| A list of property names whose widgets handle their own validation. | |
| QVector< QWidget * > | m_inputws_opts |
| Store a list of the names of input workspace boxes. | |
| QVector< QLineEdit * > | m_outputws_fields |
| Store a list of output workspace text edits. | |
| QHash< QPushButton *, int > | m_wsbtn_tracker |
| A map to keep track of replace workspace button presses. | |
| 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. | |
| QTimer | m_btnTimer |
| Enable the close button when the timer fires. | |
| bool | m_statusTracked |
| A flag to track whether the status of the algorithm is being tracked. | |
This class gives specialised dialog for the Load algorithm.
It requires that the specific load algorithm has at least 2 properties with these names:
There is no UI form as the most of the thing is dynamic.
Definition at line 47 of file LoadDialog.h.
| MantidQt::CustomDialogs::LoadDialog::LoadDialog | ( | QWidget * | parent = nullptr | ) |
Default constructor.
Definition at line 53 of file LoadDialog.cpp.
|
overrideprivateslot |
Override accept() slot.
Called when the run button is clicked.
Definition at line 118 of file LoadDialog.cpp.
References m_form, m_populating, and m_userAccept.
|
private |
Create.
Create the dynamic widgets for the concrete loader.
Definition at line 237 of file LoadDialog.cpp.
References createWidgetsForProperty(), MantidQt::API::AlgorithmDialog::getAlgorithm(), height, m_currentFiles, m_form, m_initialHeight, removeOldInputWidgets(), MantidQt::API::AlgorithmDialog::requiresUserInput(), MantidQt::API::AlgorithmDialog::setAlgorithm(), MantidQt::API::AlgorithmDialog::setPropertyValues(), MantidQt::API::AlgorithmDialog::storePropertyValue(), and tieStaticWidgets().
Referenced by createDynamicWidgets().
|
privateslot |
Create the widgets and layouts that are dynamic, i.e they depend on the specific load algorithm.
Activated when the file has been changed.
Definition at line 67 of file LoadDialog.cpp.
References createDynamicLayout(), m_form, and m_populating.
Referenced by initLayout(), and resultInspectionFinished().
|
private |
Create the widgets for a given property.
Return a layout containing suitable widgets for the given property.
| prop | A pointer to the algorithm property |
| propertyLayout | A layout where the widgets are to be placed |
| parent | The parent widget |
Definition at line 310 of file LoadDialog.cpp.
References Mantid::Kernel::Property::allowedValues(), Mantid::Kernel::Property::documentation(), index, Mantid::Kernel::Property::name(), MantidQt::API::AlgorithmDialog::tie(), and Mantid::Kernel::Property::value().
Referenced by createDynamicLayout().
|
privateslot |
Connect/Disconnect the signal that updates the workspace name with a suggested value.
| on | :: If true then a workspace name will be suggested |
Definition at line 107 of file LoadDialog.cpp.
References m_form, and suggestWSName().
Referenced by initLayout().
|
overrideprivateslot |
Override the help button clicked method.
Definition at line 76 of file LoadDialog.cpp.
References MantidQt::API::AlgorithmDialog::getAlgorithm(), and MantidQt::API::HelpWindow::showAlgorithm().
|
overrideprivatevirtual |
Initialize the layout.
Implements MantidQt::API::AlgorithmDialog.
Definition at line 151 of file LoadDialog.cpp.
References MantidQt::API::AlgorithmDialog::createDefaultButtonLayout(), createDynamicWidgets(), enableNameSuggestion(), MantidQt::API::AlgorithmDialog::getAlgorithm(), MantidQt::API::AlgorithmDialog::getOptionalMessage(), height, MantidQt::API::AlgorithmDialog::isMessageAvailable(), m_form, m_initialHeight, resultInspectionFinished(), and tieStaticWidgets().
|
private |
Clears all of the widgets from the old layout.
Clear the old widgets for a new Loader type.
| layout | :: The layout containing the child layouts/widgets |
Definition at line 215 of file LoadDialog.cpp.
References count.
Referenced by createDynamicLayout().
|
privateslot |
Accept the load dialog when user input is inspected and is valid.
Definition at line 127 of file LoadDialog.cpp.
References createDynamicWidgets(), MantidQt::API::AlgorithmDialog::getAlgorithm(), m_currentFiles, m_form, and m_userAccept.
Referenced by initLayout().
|
overrideprivatevirtual |
Save the input history.
Save the input after OK is clicked.
Reimplemented from MantidQt::API::AlgorithmDialog.
Definition at line 188 of file LoadDialog.cpp.
References m_currentFiles, and m_form.
|
privateslot |
Suggest a workspace name from the file.
Use property 'OutputWorkspace' as suggestion if present, otherwise derive a workspace name from the file (base) name.
Definition at line 87 of file LoadDialog.cpp.
References m_form.
Referenced by enableNameSuggestion().
|
private |
Tie static widgets to their properties.
| readHistory | :: If true then the history will be re read. |
Definition at line 199 of file LoadDialog.cpp.
References m_form, and MantidQt::API::AlgorithmDialog::tie().
Referenced by createDynamicLayout(), and initLayout().
|
private |
The current file.
Definition at line 88 of file LoadDialog.h.
Referenced by createDynamicLayout(), resultInspectionFinished(), and saveInput().
|
private |
Form.
Definition at line 86 of file LoadDialog.h.
Referenced by accept(), createDynamicLayout(), createDynamicWidgets(), enableNameSuggestion(), initLayout(), resultInspectionFinished(), saveInput(), suggestWSName(), and tieStaticWidgets().
|
private |
The initial height.
Definition at line 90 of file LoadDialog.h.
Referenced by createDynamicLayout(), and initLayout().
|
private |
Flag to indicating if we are populating the dialog.
Definition at line 92 of file LoadDialog.h.
Referenced by accept(), and createDynamicWidgets().
|
private |
Flag to indicate the user accepted the load dialog.
Definition at line 94 of file LoadDialog.h.
Referenced by accept(), and resultInspectionFinished().