Mantid
|
This class defines a widget for selecting a workspace of file path by using a combination of two child MantidWidgets: FileFinderWidget and WorkspaceSelector. More...
#include <DataSelector.h>
Signals | |
void | dataReady (const QString &wsname) |
Signal emitted when data is ready from a workspace selector or file browser. More... | |
void | filesFound () |
Signal emitted when files were found but widget isn't autoloading. More... | |
void | fileViewVisible () |
Signal emitted when file input is visible. More... | |
void | loadClicked () |
Signal emitted when the load button is clicked. More... | |
void | workspaceViewVisible () |
Signal emitted when workspace selector is visible. More... | |
Signals inherited from MantidQt::API::MantidWidget | |
void | runAsPythonScript (const QString &code, bool) |
Public Member Functions | |
bool | allowMultipleFiles () const |
Return whether this widget allows multiple files to be specified within the edit box. More... | |
void | allowMultipleFiles (const bool allow) |
Set whether this widget allows multiple files to be specifed or not. More... | |
DataSelector (QWidget *parent=nullptr) | |
ButtonOpts | doButtonOpt () const |
Returns the preference for how the dialog control should be. More... | |
void | doButtonOpt (const ButtonOpts buttonOpt) |
Set how the browse should appear. More... | |
bool | doMultiEntry () const |
Whether to find the number of entries in the file or assume (the normal situation) of one entry. More... | |
void | doMultiEntry (const bool multiEntry) |
Set to true to enable the period number box. More... | |
bool | extsAsSingleOption () const |
Returns whether the file dialog should display the exts as a single list or as multiple items. More... | |
void | extsAsSingleOption (const bool value) |
Sets whether the file dialog should display the exts as a single list or as multiple items. More... | |
QString | getAlgorithmProperty () const |
Returns the algorithm name. More... | |
virtual QString | getCurrentDataName () const |
Get the currently available file or workspace name. More... | |
QStringList | getFBSuffixes () |
Gets the suffixes allowed by the file browser. More... | |
QString | getFullFilePath () const |
Get the current file path in the FileFinderWidget widget. More... | |
QString | getInstrumentOverride () |
Gets the instrument override. More... | |
QString | getLabelText () const |
Return the label text on the widget. More... | |
QString | getLoadBtnText () const |
Gets the load button text. More... | |
QString | getProblem () const |
Get file problem, empty string means no error. More... | |
QString | getValidatingAlgorithm () const |
Gets if the validating algorithm of workspace selector. More... | |
QStringList | getWorkspaceTypes () const |
Gets the workspace types allowed by the workspace selector. More... | |
QString | getWsNameFromFiles () const |
Get the workspace name from the list of files. More... | |
QStringList | getWSSuffixes () |
Gets the suffixes allowed by the workspace selector. More... | |
bool | isFileSelectorVisible () const |
Get whether the file selector is currently being shown. More... | |
bool | isForDirectory () const |
Returns if this widget is for selecting a directory or not. More... | |
void | isForDirectory (const bool mode) |
Sets directory searching mode. More... | |
bool | isForRunFiles () const |
Returns if this widget is for run file searching or not. More... | |
void | isForRunFiles (const bool mode) |
Sets whether this widget is for run file searching or not. More... | |
bool | isOptional () const |
Gets if optional. More... | |
void | isOptional (bool) |
Sets if optional. More... | |
virtual bool | isValid () |
Checks if widget is in a valid state. More... | |
bool | isWorkspaceSelectorVisible () const |
Get whether the workspace selector is currently being shown. More... | |
LiveButtonOpts | liveButtonState () const |
Gets the live button state. More... | |
void | liveButtonState (const LiveButtonOpts option) |
Sets the live button state. More... | |
void | readSettings (const QString &) |
Read settings from the given group. More... | |
void | saveSettings (const QString &) |
Save settings in the given group. More... | |
void | setAlgorithmProperty (const QString &text) |
Sets an algorithm name that can be tied to this widget. More... | |
void | setAutoLoad (bool) |
Sets will auto load. More... | |
void | setFBSuffixes (const QStringList &suffixes) |
Sets the suffixes allowed by the file browser. More... | |
void | setInstrumentOverride (const QString &instName) |
Sets the instrument override. More... | |
void | setLabelText (const QString &text) |
Set the text on the label. More... | |
void | setLoadBtnText (const QString &) |
Sets the load button text. More... | |
void | setSelectorIndex (int index) |
Sets which selector (file or workspace) is visible. More... | |
void | setShowLoad (bool load) |
Set if the load button should be shown. More... | |
void | setTypeSelectorVisible (bool visible) |
Sets if the option to choose selector is visible. More... | |
void | setValidatingAlgorithm (const QString &algName) |
Sets the validating algorithm of workspace selector. More... | |
void | setWorkspaceSelectorIndex (QString const &workspaceName) |
Set the index of the combobox containing the loaded workspace. More... | |
void | setWorkspaceTypes (const QStringList &types) |
Sets the workspace types allowed by the workspace selector. More... | |
void | setWSSuffixes (const QStringList &suffixes) |
Sets the suffixes allowed by the workspace selector. More... | |
bool | showHiddenWorkspaces () const |
Gets if the workspace selector shows hidden workspaces. More... | |
void | showHiddenWorkspaces (bool show) |
Sets if the workspace selector shows hidden workspaces. More... | |
bool | showWorkspaceGroups () const |
Gets if the workspace selector shows group workspaces. More... | |
void | showWorkspaceGroups (bool show) |
Sets if the workspace selector shows workspace groups. More... | |
bool | willAutoLoad () const |
Gets will auto load. More... | |
bool | willShowLoad () |
Check if the widget will show the load button. More... | |
~DataSelector () override | |
Public Member Functions inherited from MantidQt::API::MantidWidget | |
virtual QVariant | getUserInput () const |
Returns a QVariant containing what the widget classes as user input so that input can be returned through a common interface. More... | |
virtual void | setUserInput (const QVariant &value) |
Sets a value on a mantid widget through a common interface. More... | |
Protected Member Functions | |
void | dragEnterEvent (QDragEnterEvent *) override |
Called when an item is dragged onto a control. More... | |
void | dropEvent (QDropEvent *) override |
Called when an item is dropped. More... | |
Protected Member Functions inherited from MantidQt::API::MantidWidget | |
MantidWidget (QWidget *parent=nullptr) | |
Default constructor. More... | |
QString | runPythonCode (const QString &code, bool no_output=false) |
Run python code that is passed to it and, optionally, return anything it wrote to standard output as a string. More... | |
Properties | |
QString | Algorithm |
QString | algorithmAndProperty |
bool | autoLoad |
ButtonOpts | buttonOpts |
bool | extsAsSingleOption |
QStringList | fileBrowserSuffixes |
bool | findDirectory |
bool | findRunFiles |
QString | instrumentOverride |
QString | label |
LiveButtonOpts | liveButton |
QString | loadLabelText |
bool | multiEntry |
bool | multipleFiles |
bool | optional |
bool | ShowGroups |
bool | ShowHidden |
bool | showLoad |
QStringList | workspaceSuffixes |
QStringList | WorkspaceTypes |
Private Slots | |
void | handleAutoLoadComplete (bool error) |
Slot called if the widget fails to auto load the file. More... | |
void | handleFileInput () |
Slot called when file input is available. More... | |
void | handleViewChanged (int index) |
Slot called when the current view is changed. More... | |
void | handleWorkspaceInput () |
Slot called when workspace input is available. More... | |
Private Member Functions | |
void | autoLoadFile (const QString &filenames) |
Attempt to automatically load a file. More... | |
Private Attributes | |
MantidQt::API::AlgorithmRunner | m_algRunner |
Algorithm Runner used to run the load algorithm. More... | |
bool | m_autoLoad |
Flag to enable auto loading. By default this is set to true. More... | |
bool | m_isOptional |
Flag if optional. More... | |
bool | m_showLoad |
Flag to show or hide the load button. By default this is set to true. More... | |
Ui::DataSelector | m_uiForm |
Member containing the widgets child widgets. More... | |
This class defines a widget for selecting a workspace of file path by using a combination of two child MantidWidgets: FileFinderWidget and WorkspaceSelector.
This widget combines the two to produce a single composite widget that emits signals when the user has chosen appropriate input.
Definition at line 35 of file DataSelector.h.
MantidQt::MantidWidgets::DataSelector::DataSelector | ( | QWidget * | parent = nullptr | ) |
Definition at line 62 of file DataSelector.cpp.
References handleAutoLoadComplete(), handleFileInput(), handleViewChanged(), handleWorkspaceInput(), loadClicked(), m_algRunner, and m_uiForm.
|
overridedefault |
|
inline |
Return whether this widget allows multiple files to be specified within the edit box.
Definition at line 117 of file DataSelector.h.
|
inline |
Set whether this widget allows multiple files to be specifed or not.
allow | :: If true then the widget will accept multiple files else only a single file may be specified |
Definition at line 126 of file DataSelector.h.
|
private |
Attempt to automatically load a file.
Attempt to load a file if the widget is set to attempt auto-loading.
Function creates an instance of the load algorithm and attaches it to a algorithm runner to attempt loading.
filepath | :: The file path to load |
Definition at line 212 of file DataSelector.cpp.
References getWsNameFromFiles(), Mantid::Kernel::SingletonHolder< T >::Instance(), m_algRunner, and MantidQt::API::AlgorithmRunner::startAlgorithm().
Referenced by handleFileInput().
|
signal |
Signal emitted when data is ready from a workspace selector or file browser.
Referenced by handleAutoLoadComplete(), and handleWorkspaceInput().
|
inline |
Returns the preference for how the dialog control should be.
Definition at line 237 of file DataSelector.h.
|
inline |
Set how the browse should appear.
buttonOpt | :: the preference for the control, if there will be one, to activate the dialog box |
Definition at line 245 of file DataSelector.h.
|
inline |
Whether to find the number of entries in the file or assume (the normal situation) of one entry.
Definition at line 169 of file DataSelector.h.
|
inline |
Set to true to enable the period number box.
multiEntry | whether to show the multiperiod box |
Definition at line 175 of file DataSelector.h.
|
overrideprotected |
Called when an item is dragged onto a control.
de | :: the drag event data package |
Definition at line 450 of file DataSelector.cpp.
|
overrideprotected |
Called when an item is dropped.
de | :: the drop event data package |
Definition at line 402 of file DataSelector.cpp.
References m_uiForm, and setWorkspaceSelectorIndex().
|
inline |
Returns whether the file dialog should display the exts as a single list or as multiple items.
Definition at line 195 of file DataSelector.h.
|
inline |
Sets whether the file dialog should display the exts as a single list or as multiple items.
value | :: If true the file dialog wil contain a single entry will all filters |
Definition at line 203 of file DataSelector.h.
References value.
|
signal |
Signal emitted when files were found but widget isn't autoloading.
Referenced by handleFileInput().
|
signal |
Signal emitted when file input is visible.
Referenced by handleViewChanged().
|
inline |
Returns the algorithm name.
Definition at line 181 of file DataSelector.h.
|
virtual |
Get the currently available file or workspace name.
Gets the name of item selected in the DataSelector.
This will return the currently selected item in the workspace selector, if the workspace view is active. If the file view is active, it will return the basename of the file. If multiple files are allowed, and auto-loading is off, it will return the full user input. If there is no valid input the method returns an empty string.
Definition at line 312 of file DataSelector.cpp.
References getFullFilePath(), getWsNameFromFiles(), index, m_autoLoad, and m_uiForm.
Referenced by isValid().
|
inline |
Gets the suffixes allowed by the file browser.
Definition at line 210 of file DataSelector.h.
QString MantidQt::MantidWidgets::DataSelector::getFullFilePath | ( | ) | const |
Get the current file path in the FileFinderWidget widget.
Gets the full file path currently in the file browser.
Definition at line 280 of file DataSelector.cpp.
References m_uiForm.
Referenced by getCurrentDataName(), and getWsNameFromFiles().
|
inline |
Gets the instrument override.
Definition at line 224 of file DataSelector.h.
|
inline |
Return the label text on the widget.
Definition at line 156 of file DataSelector.h.
QString MantidQt::MantidWidgets::DataSelector::getLoadBtnText | ( | ) | const |
Gets the load button text.
Gets the text displayed on the load button.
Definition at line 358 of file DataSelector.cpp.
References m_uiForm.
QString MantidQt::MantidWidgets::DataSelector::getProblem | ( | ) | const |
Get file problem, empty string means no error.
Return the error.
Definition at line 190 of file DataSelector.cpp.
References isFileSelectorVisible(), and m_uiForm.
Referenced by MantidQt::CustomInterfaces::UserInputValidator::checkDataSelectorIsValid().
|
inline |
Gets if the validating algorithm of workspace selector.
Definition at line 323 of file DataSelector.h.
|
inline |
Gets the workspace types allowed by the workspace selector.
Definition at line 281 of file DataSelector.h.
QString MantidQt::MantidWidgets::DataSelector::getWsNameFromFiles | ( | ) | const |
Get the workspace name from the list of files.
Gets the workspace name that is created after loading the files.
Definition at line 287 of file DataSelector.cpp.
References getFullFilePath(), and m_uiForm.
Referenced by autoLoadFile(), getCurrentDataName(), and handleAutoLoadComplete().
|
inline |
Gets the suffixes allowed by the workspace selector.
Definition at line 267 of file DataSelector.h.
|
privateslot |
Slot called if the widget fails to auto load the file.
Handles when the load algorithm completes.
error | :: Whether loading completed without error |
Definition at line 229 of file DataSelector.cpp.
References dataReady(), error, getWsNameFromFiles(), and m_uiForm.
Referenced by DataSelector().
|
privateslot |
Slot called when file input is available.
Handle signals when files are found or the user manually clicks load.
Definition at line 99 of file DataSelector.cpp.
References autoLoadFile(), filesFound(), m_autoLoad, and m_uiForm.
Referenced by DataSelector().
|
privateslot |
Slot called when the current view is changed.
Handles when the view changes between workspace and file selection.
index | :: The index the stacked widget has been switched too. |
Definition at line 259 of file DataSelector.cpp.
References fileViewVisible(), handleWorkspaceInput(), index, m_uiForm, and workspaceViewVisible().
Referenced by DataSelector().
|
privateslot |
Slot called when workspace input is available.
Handles when the user select a workspace in the workspace selector.
Definition at line 242 of file DataSelector.cpp.
References dataReady(), and m_uiForm.
Referenced by DataSelector(), and handleViewChanged().
bool MantidQt::MantidWidgets::DataSelector::isFileSelectorVisible | ( | ) | const |
Get whether the file selector is currently being shown.
Get if the file selector is currently being shown.
Definition at line 131 of file DataSelector.cpp.
References index, and m_uiForm.
Referenced by getProblem(), isValid(), and isWorkspaceSelectorVisible().
|
inline |
Returns if this widget is for selecting a directory or not.
Definition at line 144 of file DataSelector.h.
|
inline |
Sets directory searching mode.
mode | True to search for directories only |
Definition at line 150 of file DataSelector.h.
|
inline |
Returns if this widget is for run file searching or not.
Definition at line 132 of file DataSelector.h.
|
inline |
Sets whether this widget is for run file searching or not.
mode | :: True if this widget searches for run files, false otherwise |
Definition at line 138 of file DataSelector.h.
bool MantidQt::MantidWidgets::DataSelector::isOptional | ( | ) | const |
Gets if optional.
Return whether empty input is allowed.
Definition at line 84 of file DataSelector.cpp.
References m_isOptional.
void MantidQt::MantidWidgets::DataSelector::isOptional | ( | bool | optional | ) |
Sets if optional.
Sets if the text field is optional.
optional | :: Set the optional status of the text field |
Definition at line 90 of file DataSelector.cpp.
References m_isOptional, m_uiForm, and optional.
|
virtual |
Checks if widget is in a valid state.
Check if the data selector is in a valid state.
Checks using the relvant widgets isValid method depending on what view is currently being shown
Definition at line 151 of file DataSelector.cpp.
References getCurrentDataName(), isFileSelectorVisible(), isValid(), m_autoLoad, and m_uiForm.
Referenced by MantidQt::CustomInterfaces::UserInputValidator::checkDataSelectorIsValid(), and isValid().
bool MantidQt::MantidWidgets::DataSelector::isWorkspaceSelectorVisible | ( | ) | const |
Get whether the workspace selector is currently being shown.
Get if the workspace selector is currently being shown.
Definition at line 141 of file DataSelector.cpp.
References isFileSelectorVisible().
|
inline |
Gets the live button state.
Definition at line 252 of file DataSelector.h.
|
inline |
Sets the live button state.
option | :: livebutton option |
Definition at line 259 of file DataSelector.h.
|
signal |
Signal emitted when the load button is clicked.
Referenced by DataSelector().
void MantidQt::MantidWidgets::DataSelector::readSettings | ( | const QString & | group | ) |
Read settings from the given group.
group | :: The name of the group key to retrieve data from |
Definition at line 371 of file DataSelector.cpp.
References m_uiForm.
void MantidQt::MantidWidgets::DataSelector::saveSettings | ( | const QString & | group | ) |
Save settings in the given group.
Save settings to the given group.
group | :: The name of the group key to save to |
Definition at line 377 of file DataSelector.cpp.
References m_uiForm.
|
inline |
Sets an algorithm name that can be tied to this widget.
text | :: The name of the algorithm and property in the form [AlgorithmName|PropertyName] |
Definition at line 188 of file DataSelector.h.
void MantidQt::MantidWidgets::DataSelector::setAutoLoad | ( | bool | load | ) |
Sets will auto load.
Sets whether the widget will attempt to auto load files.
load | :: Whether the widget will auto load |
Definition at line 351 of file DataSelector.cpp.
References m_autoLoad.
|
inline |
Sets the suffixes allowed by the file browser.
suffixes | :: List of suffixes allowed by the file browser |
Definition at line 217 of file DataSelector.h.
|
inline |
Sets the instrument override.
instName | :: name of instrument override |
Definition at line 231 of file DataSelector.h.
|
inline |
Set the text on the label.
text | :: A string giving the label to use for the text |
Definition at line 162 of file DataSelector.h.
void MantidQt::MantidWidgets::DataSelector::setLoadBtnText | ( | const QString & | text | ) |
Sets the load button text.
Sets the text shown on the load button.
text | :: The text to display on the button |
Definition at line 365 of file DataSelector.cpp.
References m_uiForm.
void MantidQt::MantidWidgets::DataSelector::setSelectorIndex | ( | int | index | ) |
Sets which selector (file or workspace) is visible.
Sets whether the file or workspace selector is visible.
Definition at line 119 of file DataSelector.cpp.
void MantidQt::MantidWidgets::DataSelector::setShowLoad | ( | bool | load | ) |
Set if the load button should be shown.
Set if the load button will be shown or not This will change if the button widget is visible and enabled.
load | :: Whether the load button will be shown |
Definition at line 392 of file DataSelector.cpp.
References m_showLoad, and m_uiForm.
void MantidQt::MantidWidgets::DataSelector::setTypeSelectorVisible | ( | bool | visible | ) |
Sets if the option to choose selector is visible.
Sets whether the file or workspace type selector is visible.
Definition at line 124 of file DataSelector.cpp.
References m_uiForm.
|
inline |
Sets the validating algorithm of workspace selector.
algName | :: validating algorithm |
Definition at line 330 of file DataSelector.h.
void MantidQt::MantidWidgets::DataSelector::setWorkspaceSelectorIndex | ( | QString const & | workspaceName | ) |
Set the index of the combobox containing the loaded workspace.
This sets the workspace selector's index to the workspace which was dragged and dropped onto the data selector.
workspaceName | :: the name of the workspace dragged onto the selector |
Definition at line 441 of file DataSelector.cpp.
References index, and m_uiForm.
Referenced by dropEvent().
|
inline |
Sets the workspace types allowed by the workspace selector.
types | :: List of workspace types allowed by the workspace selector |
Definition at line 288 of file DataSelector.h.
|
inline |
Sets the suffixes allowed by the workspace selector.
suffixes | :: List of suffixes allowed by the workspace selector |
Definition at line 274 of file DataSelector.h.
|
inline |
Gets if the workspace selector shows hidden workspaces.
Definition at line 295 of file DataSelector.h.
|
inline |
Sets if the workspace selector shows hidden workspaces.
show | :: Boolean flag if hidden workspaces are shown |
Definition at line 302 of file DataSelector.h.
|
inline |
Gets if the workspace selector shows group workspaces.
Definition at line 309 of file DataSelector.h.
|
inline |
Sets if the workspace selector shows workspace groups.
show | :: Boolean flag if group workspaces are shown |
Definition at line 316 of file DataSelector.h.
bool MantidQt::MantidWidgets::DataSelector::willAutoLoad | ( | ) | const |
Gets will auto load.
Gets whether the widget will attempt to auto load files.
Definition at line 344 of file DataSelector.cpp.
References m_autoLoad.
bool MantidQt::MantidWidgets::DataSelector::willShowLoad | ( | ) |
Check if the widget will show the load button.
Check if the load button will be shown on the interface.
Definition at line 384 of file DataSelector.cpp.
References m_showLoad.
|
signal |
Signal emitted when workspace selector is visible.
Referenced by handleViewChanged().
|
private |
Algorithm Runner used to run the load algorithm.
Definition at line 367 of file DataSelector.h.
Referenced by autoLoadFile(), and DataSelector().
|
private |
Flag to enable auto loading. By default this is set to true.
Definition at line 369 of file DataSelector.h.
Referenced by getCurrentDataName(), handleFileInput(), isValid(), setAutoLoad(), and willAutoLoad().
|
private |
|
private |
Flag to show or hide the load button. By default this is set to true.
Definition at line 371 of file DataSelector.h.
Referenced by setShowLoad(), and willShowLoad().
|
private |
Member containing the widgets child widgets.
Definition at line 365 of file DataSelector.h.
Referenced by DataSelector(), dropEvent(), getCurrentDataName(), getFullFilePath(), getLoadBtnText(), getProblem(), getWsNameFromFiles(), handleAutoLoadComplete(), handleFileInput(), handleViewChanged(), handleWorkspaceInput(), isFileSelectorVisible(), isOptional(), isValid(), readSettings(), saveSettings(), setLoadBtnText(), setSelectorIndex(), setShowLoad(), setTypeSelectorVisible(), and setWorkspaceSelectorIndex().
|
readwrite |
Definition at line 35 of file DataSelector.h.
|
readwrite |
Definition at line 35 of file DataSelector.h.
|
readwrite |
Definition at line 35 of file DataSelector.h.
|
readwrite |
Definition at line 35 of file DataSelector.h.
|
readwrite |
Definition at line 35 of file DataSelector.h.
|
readwrite |
Definition at line 35 of file DataSelector.h.
|
readwrite |
Definition at line 35 of file DataSelector.h.
|
readwrite |
Definition at line 35 of file DataSelector.h.
|
readwrite |
Definition at line 35 of file DataSelector.h.
|
readwrite |
Definition at line 35 of file DataSelector.h.
|
readwrite |
Definition at line 35 of file DataSelector.h.
|
readwrite |
Definition at line 35 of file DataSelector.h.
|
readwrite |
Definition at line 35 of file DataSelector.h.
|
readwrite |
Definition at line 35 of file DataSelector.h.
|
readwrite |
Definition at line 35 of file DataSelector.h.
Referenced by isOptional().
|
readwrite |
Definition at line 35 of file DataSelector.h.
|
readwrite |
Definition at line 35 of file DataSelector.h.
|
readwrite |
Definition at line 35 of file DataSelector.h.
|
readwrite |
Definition at line 35 of file DataSelector.h.
|
readwrite |
Definition at line 35 of file DataSelector.h.