Mantid
Loading...
Searching...
No Matches
Signals | Public Member Functions | Protected Member Functions | Properties | Private Member Functions | Private Attributes | Friends | List of all members
MantidQt::MantidWidgets::WorkspaceSelector Class Reference

This class defines a widget for selecting a workspace present in the AnalysisDataService. More...

#include <WorkspaceSelector.h>

Inheritance diagram for MantidQt::MantidWidgets::WorkspaceSelector:

Signals

void emptied ()
 
void focussed ()
 

Public Member Functions

void connectObservers ()
 Subscribes this object to the Poco NotificationCentre. More...
 
void disconnectObservers ()
 De-subscribes this object from the Poco NotificationCentre. More...
 
QStringList getSuffixes () const
 
QString getValidatingAlgorithm () const
 
QStringList getWorkspaceTypes () const
 
bool isConnected () const
 
bool isOptional () const
 
bool isSorted () const
 
bool isValid () const
 
void refresh ()
 
void setLowerBinLimit (int numberOfBins)
 
void setOptional (bool optional)
 
void setSorted (bool sorted)
 
void setSuffixes (const QStringList &suffix)
 
void setUpperBinLimit (int numberOfBins)
 
void setValidatingAlgorithm (const QString &algName)
 
void setWorkspaceTypes (const QStringList &types)
 
bool showHiddenWorkspaces () const
 
void showHiddenWorkspaces (bool show)
 
bool showWorkspaceGroups () const
 
void showWorkspaceGroups (bool show)
 
 WorkspaceSelector (QWidget *parent=nullptr, bool init=true)
 Default Constructor. More...
 
 ~WorkspaceSelector () override
 Destructor. 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...
 
void focusInEvent (QFocusEvent *) override
 Called when there is an interaction with the widget. More...
 

Properties

QString Algorithm
 
bool Optional
 
bool ShowGroups
 
bool ShowHidden
 
bool Sorted
 
QStringList Suffix
 
QStringList WorkspaceTypes
 

Private Member Functions

bool checkEligibility (const QString &name, const Mantid::API::Workspace_sptr &object) const
 
void handleAddEvent (Mantid::API::WorkspaceAddNotification_ptr pNf)
 
void handleClearEvent (Mantid::API::ClearADSNotification_ptr pNf)
 
void handleRemEvent (Mantid::API::WorkspacePostDeleteNotification_ptr pNf)
 
void handleRenameEvent (Mantid::API::WorkspaceRenameNotification_ptr pNf)
 
void handleReplaceEvent (Mantid::API::WorkspaceAfterReplaceNotification_ptr pNf)
 
bool hasValidNumberOfBins (const Mantid::API::Workspace_sptr &object) const
 
bool hasValidSuffix (const QString &name) const
 

Private Attributes

Poco::NObserver< WorkspaceSelector, Mantid::API::WorkspaceAddNotificationm_addObserver
 Poco Observers for ADS Notifications. More...
 
std::mutex m_adsMutex
 
QString m_algName
 
std::shared_ptr< Mantid::API::Algorithmm_algorithm
 
QString m_algPropName
 
std::pair< int, int > m_binLimits
 Allows you to put limits on the size of the workspace i.e. number of bins. More...
 
Poco::NObserver< WorkspaceSelector, Mantid::API::ClearADSNotificationm_clearObserver
 
bool m_connected
 
bool m_init
 
bool m_optional
 Whether to add an extra empty entry to the combobox. More...
 
Poco::NObserver< WorkspaceSelector, Mantid::API::WorkspacePostDeleteNotificationm_remObserver
 
Poco::NObserver< WorkspaceSelector, Mantid::API::WorkspaceRenameNotificationm_renameObserver
 
Poco::NObserver< WorkspaceSelector, Mantid::API::WorkspaceAfterReplaceNotificationm_replaceObserver
 
bool m_showGroups
 
bool m_showHidden
 Whether to show "hidden" workspaces. More...
 
bool m_sorted
 Whetherthe combobox model should be kept sorted. More...
 
QStringList m_suffix
 
QStringList m_workspaceTypes
 A list of workspace types that should be shown in the ComboBox. More...
 

Friends

class DataSelector
 

Detailed Description

This class defines a widget for selecting a workspace present in the AnalysisDataService.

Subscribes to the WorkspaceAddNotification and WorkspaceDeleteNotification from the ADS.

Types of workspace to show can be restricted in several ways:

By listing allowed WorkspaceIDs to show (Workspace2D, TableWorkspace, etc) By deciding whether or not to show "hidden" workspaces (identified with a double underscore at the start of the workspace name By providing a suffix that the workspace name must have By giving the name of an algorithm, each workspace will be validated as an input to the workspaces first input WorkspaceProperty

Author
Michael Whitty
Date
23/02/2011

Definition at line 47 of file WorkspaceSelector.h.

Constructor & Destructor Documentation

◆ WorkspaceSelector()

WorkspaceSelector::WorkspaceSelector ( QWidget *  parent = nullptr,
bool  init = true 
)

Default Constructor.

Default constructor.

Parameters
parent:: A widget to act as this widget's parent (default = NULL)
init:: If true then the widget will make calls to the framework (default = true)

Definition at line 35 of file WorkspaceSelector.cpp.

References connectObservers().

◆ ~WorkspaceSelector()

WorkspaceSelector::~WorkspaceSelector ( )
override

Destructor.

Destructor for WorkspaceSelector De-subscribes this object from the Poco NotificationCentre.

Definition at line 56 of file WorkspaceSelector.cpp.

References disconnectObservers().

Member Function Documentation

◆ checkEligibility()

bool WorkspaceSelector::checkEligibility ( const QString &  name,
const Mantid::API::Workspace_sptr object 
) const
private

◆ connectObservers()

void WorkspaceSelector::connectObservers ( )

◆ disconnectObservers()

void WorkspaceSelector::disconnectObservers ( )

De-subscribes this object from the Poco NotificationCentre.

Definition at line 61 of file WorkspaceSelector.cpp.

References Mantid::Kernel::SingletonHolder< T >::Instance(), m_addObserver, m_clearObserver, m_connected, m_init, m_remObserver, m_renameObserver, and m_replaceObserver.

Referenced by ~WorkspaceSelector().

◆ dragEnterEvent()

void WorkspaceSelector::dragEnterEvent ( QDragEnterEvent *  de)
overrideprotected

Called when an item is dragged onto a control.

Parameters
de:: the drag event data package

Definition at line 374 of file WorkspaceSelector.cpp.

References m_adsMutex.

◆ dropEvent()

void WorkspaceSelector::dropEvent ( QDropEvent *  de)
overrideprotected

Called when an item is dropped.

Parameters
de:: the drop event data package

Definition at line 353 of file WorkspaceSelector.cpp.

References index, and m_adsMutex.

◆ emptied

void MantidQt::MantidWidgets::WorkspaceSelector::emptied ( )
signal

Referenced by handleClearEvent(), and handleRemEvent().

◆ focusInEvent()

void WorkspaceSelector::focusInEvent ( QFocusEvent *  )
overrideprotected

Called when there is an interaction with the widget.

Definition at line 387 of file WorkspaceSelector.cpp.

References focussed().

◆ focussed

void MantidQt::MantidWidgets::WorkspaceSelector::focussed ( )
signal

Referenced by focusInEvent().

◆ getSuffixes()

QStringList WorkspaceSelector::getSuffixes ( ) const

Definition at line 145 of file WorkspaceSelector.cpp.

References m_suffix.

◆ getValidatingAlgorithm()

QString WorkspaceSelector::getValidatingAlgorithm ( ) const

Definition at line 160 of file WorkspaceSelector.cpp.

References m_algName.

◆ getWorkspaceTypes()

QStringList WorkspaceSelector::getWorkspaceTypes ( ) const

Definition at line 88 of file WorkspaceSelector.cpp.

References m_workspaceTypes.

◆ handleAddEvent()

void WorkspaceSelector::handleAddEvent ( Mantid::API::WorkspaceAddNotification_ptr  pNf)
private

◆ handleClearEvent()

void WorkspaceSelector::handleClearEvent ( Mantid::API::ClearADSNotification_ptr  pNf)
private

Definition at line 213 of file WorkspaceSelector.cpp.

References addItem(), emptied(), m_adsMutex, and m_optional.

◆ handleRemEvent()

void WorkspaceSelector::handleRemEvent ( Mantid::API::WorkspacePostDeleteNotification_ptr  pNf)
private

Definition at line 201 of file WorkspaceSelector.cpp.

References emptied(), index, m_adsMutex, and removeItem().

◆ handleRenameEvent()

void WorkspaceSelector::handleRenameEvent ( Mantid::API::WorkspaceRenameNotification_ptr  pNf)
private

◆ handleReplaceEvent()

void WorkspaceSelector::handleReplaceEvent ( Mantid::API::WorkspaceAfterReplaceNotification_ptr  pNf)
private

◆ hasValidNumberOfBins()

bool WorkspaceSelector::hasValidNumberOfBins ( const Mantid::API::Workspace_sptr object) const
private

Definition at line 311 of file WorkspaceSelector.cpp.

References m_binLimits, and workspace.

Referenced by checkEligibility().

◆ hasValidSuffix()

bool WorkspaceSelector::hasValidSuffix ( const QString &  name) const
private

Definition at line 297 of file WorkspaceSelector.cpp.

References m_suffix.

Referenced by checkEligibility().

◆ isConnected()

bool WorkspaceSelector::isConnected ( ) const

Definition at line 143 of file WorkspaceSelector.cpp.

References m_connected.

◆ isOptional()

bool WorkspaceSelector::isOptional ( ) const

Definition at line 123 of file WorkspaceSelector.cpp.

References m_optional.

◆ isSorted()

bool WorkspaceSelector::isSorted ( ) const

Definition at line 133 of file WorkspaceSelector.cpp.

References m_sorted.

Referenced by handleAddEvent(), handleRenameEvent(), handleReplaceEvent(), and refresh().

◆ isValid()

bool WorkspaceSelector::isValid ( ) const

Definition at line 121 of file WorkspaceSelector.cpp.

◆ refresh()

void WorkspaceSelector::refresh ( )

◆ setLowerBinLimit()

void WorkspaceSelector::setLowerBinLimit ( int  numberOfBins)

Definition at line 156 of file WorkspaceSelector.cpp.

References m_binLimits.

◆ setOptional()

void WorkspaceSelector::setOptional ( bool  optional)

Definition at line 125 of file WorkspaceSelector.cpp.

References m_init, m_optional, and refresh().

◆ setSorted()

void WorkspaceSelector::setSorted ( bool  sorted)

Definition at line 135 of file WorkspaceSelector.cpp.

References m_init, m_sorted, and refresh().

◆ setSuffixes()

void WorkspaceSelector::setSuffixes ( const QStringList &  suffix)

Definition at line 147 of file WorkspaceSelector.cpp.

References m_init, m_suffix, and refresh().

◆ setUpperBinLimit()

void WorkspaceSelector::setUpperBinLimit ( int  numberOfBins)

Definition at line 158 of file WorkspaceSelector.cpp.

References m_binLimits.

◆ setValidatingAlgorithm()

void WorkspaceSelector::setValidatingAlgorithm ( const QString &  algName)

◆ setWorkspaceTypes()

void WorkspaceSelector::setWorkspaceTypes ( const QStringList &  types)

Definition at line 90 of file WorkspaceSelector.cpp.

References m_init, m_workspaceTypes, and refresh().

◆ showHiddenWorkspaces() [1/2]

bool WorkspaceSelector::showHiddenWorkspaces ( ) const

Definition at line 99 of file WorkspaceSelector.cpp.

References m_showHidden.

Referenced by handleAddEvent(), and refresh().

◆ showHiddenWorkspaces() [2/2]

void WorkspaceSelector::showHiddenWorkspaces ( bool  show)

Definition at line 101 of file WorkspaceSelector.cpp.

References m_init, m_showHidden, and refresh().

◆ showWorkspaceGroups() [1/2]

bool WorkspaceSelector::showWorkspaceGroups ( ) const

Definition at line 110 of file WorkspaceSelector.cpp.

References m_showGroups.

◆ showWorkspaceGroups() [2/2]

void WorkspaceSelector::showWorkspaceGroups ( bool  show)

Definition at line 112 of file WorkspaceSelector.cpp.

References m_init, m_showGroups, and refresh().

Friends And Related Function Documentation

◆ DataSelector

friend class DataSelector
friend

Definition at line 57 of file WorkspaceSelector.h.

Member Data Documentation

◆ m_addObserver

Poco::NObserver<WorkspaceSelector, Mantid::API::WorkspaceAddNotification> MantidQt::MantidWidgets::WorkspaceSelector::m_addObserver
private

Poco Observers for ADS Notifications.

Definition at line 114 of file WorkspaceSelector.h.

Referenced by connectObservers(), and disconnectObservers().

◆ m_adsMutex

std::mutex MantidQt::MantidWidgets::WorkspaceSelector::m_adsMutex
private

◆ m_algName

QString MantidQt::MantidWidgets::WorkspaceSelector::m_algName
private

Definition at line 136 of file WorkspaceSelector.h.

Referenced by getValidatingAlgorithm(), and setValidatingAlgorithm().

◆ m_algorithm

std::shared_ptr<Mantid::API::Algorithm> MantidQt::MantidWidgets::WorkspaceSelector::m_algorithm
private

Definition at line 140 of file WorkspaceSelector.h.

Referenced by checkEligibility(), and setValidatingAlgorithm().

◆ m_algPropName

QString MantidQt::MantidWidgets::WorkspaceSelector::m_algPropName
private

Definition at line 137 of file WorkspaceSelector.h.

Referenced by checkEligibility(), and setValidatingAlgorithm().

◆ m_binLimits

std::pair<int, int> MantidQt::MantidWidgets::WorkspaceSelector::m_binLimits
private

Allows you to put limits on the size of the workspace i.e. number of bins.

Definition at line 134 of file WorkspaceSelector.h.

Referenced by hasValidNumberOfBins(), setLowerBinLimit(), and setUpperBinLimit().

◆ m_clearObserver

Poco::NObserver<WorkspaceSelector, Mantid::API::ClearADSNotification> MantidQt::MantidWidgets::WorkspaceSelector::m_clearObserver
private

Definition at line 116 of file WorkspaceSelector.h.

Referenced by connectObservers(), and disconnectObservers().

◆ m_connected

bool MantidQt::MantidWidgets::WorkspaceSelector::m_connected
private

Definition at line 121 of file WorkspaceSelector.h.

Referenced by connectObservers(), disconnectObservers(), and isConnected().

◆ m_init

bool MantidQt::MantidWidgets::WorkspaceSelector::m_init
private

◆ m_optional

bool MantidQt::MantidWidgets::WorkspaceSelector::m_optional
private

Whether to add an extra empty entry to the combobox.

Definition at line 130 of file WorkspaceSelector.h.

Referenced by handleClearEvent(), isOptional(), refresh(), and setOptional().

◆ m_remObserver

Poco::NObserver<WorkspaceSelector, Mantid::API::WorkspacePostDeleteNotification> MantidQt::MantidWidgets::WorkspaceSelector::m_remObserver
private

Definition at line 115 of file WorkspaceSelector.h.

Referenced by connectObservers(), and disconnectObservers().

◆ m_renameObserver

Poco::NObserver<WorkspaceSelector, Mantid::API::WorkspaceRenameNotification> MantidQt::MantidWidgets::WorkspaceSelector::m_renameObserver
private

Definition at line 117 of file WorkspaceSelector.h.

Referenced by connectObservers(), and disconnectObservers().

◆ m_replaceObserver

Poco::NObserver<WorkspaceSelector, Mantid::API::WorkspaceAfterReplaceNotification> MantidQt::MantidWidgets::WorkspaceSelector::m_replaceObserver
private

Definition at line 118 of file WorkspaceSelector.h.

Referenced by connectObservers(), and disconnectObservers().

◆ m_showGroups

bool MantidQt::MantidWidgets::WorkspaceSelector::m_showGroups
private

Definition at line 128 of file WorkspaceSelector.h.

Referenced by checkEligibility(), and showWorkspaceGroups().

◆ m_showHidden

bool MantidQt::MantidWidgets::WorkspaceSelector::m_showHidden
private

Whether to show "hidden" workspaces.

Definition at line 126 of file WorkspaceSelector.h.

Referenced by showHiddenWorkspaces().

◆ m_sorted

bool MantidQt::MantidWidgets::WorkspaceSelector::m_sorted
private

Whetherthe combobox model should be kept sorted.

Definition at line 132 of file WorkspaceSelector.h.

Referenced by isSorted(), and setSorted().

◆ m_suffix

QStringList MantidQt::MantidWidgets::WorkspaceSelector::m_suffix
private

Definition at line 135 of file WorkspaceSelector.h.

Referenced by getSuffixes(), hasValidSuffix(), and setSuffixes().

◆ m_workspaceTypes

QStringList MantidQt::MantidWidgets::WorkspaceSelector::m_workspaceTypes
private

A list of workspace types that should be shown in the ComboBox.

Definition at line 124 of file WorkspaceSelector.h.

Referenced by checkEligibility(), getWorkspaceTypes(), and setWorkspaceTypes().

Property Documentation

◆ Algorithm

QString MantidQt::MantidWidgets::WorkspaceSelector::Algorithm
readwrite

Definition at line 47 of file WorkspaceSelector.h.

◆ Optional

bool MantidQt::MantidWidgets::WorkspaceSelector::Optional
readwrite

Definition at line 47 of file WorkspaceSelector.h.

◆ ShowGroups

bool MantidQt::MantidWidgets::WorkspaceSelector::ShowGroups
readwrite

Definition at line 47 of file WorkspaceSelector.h.

◆ ShowHidden

bool MantidQt::MantidWidgets::WorkspaceSelector::ShowHidden
readwrite

Definition at line 47 of file WorkspaceSelector.h.

◆ Sorted

bool MantidQt::MantidWidgets::WorkspaceSelector::Sorted
readwrite

Definition at line 47 of file WorkspaceSelector.h.

◆ Suffix

QStringList MantidQt::MantidWidgets::WorkspaceSelector::Suffix
readwrite

Definition at line 47 of file WorkspaceSelector.h.

◆ WorkspaceTypes

QStringList MantidQt::MantidWidgets::WorkspaceSelector::WorkspaceTypes
readwrite

Definition at line 47 of file WorkspaceSelector.h.


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