Skip to content
Snippets Groups Projects
Commit aed5ed18 authored by Anton Piccardo-Selg's avatar Anton Piccardo-Selg
Browse files

Refs #11947 Hedge for empty active source

parent 19a94d49
No related branches found
No related tags found
No related merge requests found
...@@ -145,6 +145,8 @@ public: ...@@ -145,6 +145,8 @@ public:
void setColorScaleLock(Mantid::VATES::ColorScaleLock* colorScaleLock); void setColorScaleLock(Mantid::VATES::ColorScaleLock* colorScaleLock);
QPointer<pqPipelineSource> origSrc; ///< The original source QPointer<pqPipelineSource> origSrc; ///< The original source
QPointer<pqPipelineRepresentation> origRep; ///< The original source representation QPointer<pqPipelineRepresentation> origRep; ///< The original source representation
/// Has active source
bool hasActiveSource();
public slots: public slots:
/// Set the color scale back to the original bounds. /// Set the color scale back to the original bounds.
......
...@@ -229,6 +229,11 @@ void StandardView::render() ...@@ -229,6 +229,11 @@ void StandardView::render()
} }
void StandardView::onCutButtonClicked() { void StandardView::onCutButtonClicked() {
// check that has active source
if (!hasActiveSource()) {
return;
}
// Apply cut to currently viewed data // Apply cut to currently viewed data
pqObjectBuilder *builder = pqApplicationCore::instance()->getObjectBuilder(); pqObjectBuilder *builder = pqApplicationCore::instance()->getObjectBuilder();
builder->createFilter("filters", "Cut", this->getPvActiveSrc()); builder->createFilter("filters", "Cut", this->getPvActiveSrc());
...@@ -239,6 +244,11 @@ void StandardView::onCutButtonClicked() { ...@@ -239,6 +244,11 @@ void StandardView::onCutButtonClicked() {
} }
void StandardView::onScaleButtonClicked() { void StandardView::onScaleButtonClicked() {
// check that has active source
if (!hasActiveSource()) {
return;
}
pqObjectBuilder *builder = pqApplicationCore::instance()->getObjectBuilder(); pqObjectBuilder *builder = pqApplicationCore::instance()->getObjectBuilder();
this->m_scaler = builder->createFilter( this->m_scaler = builder->createFilter(
"filters", "MantidParaViewScaleWorkspace", this->getPvActiveSrc()); "filters", "MantidParaViewScaleWorkspace", this->getPvActiveSrc());
......
...@@ -954,6 +954,13 @@ void ViewBase::setAxesGrid(bool on) { ...@@ -954,6 +954,13 @@ void ViewBase::setAxesGrid(bool on) {
} }
} }
/**
* Check if there is an active source available
* @returns true if there is an active source else false
*/
bool ViewBase::hasActiveSource() {
return this->getPvActiveSrc() != nullptr;
}
} // namespace SimpleGui } // namespace SimpleGui
} // namespace Vates } // namespace Vates
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment