Skip to content

Commit

Permalink
Refs #10537 Fixing issue with view buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonPiccardoSelg committed Dec 5, 2014
1 parent 5d4c404 commit d2b904c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 19 deletions.
7 changes: 0 additions & 7 deletions Code/Mantid/Vates/VatesAPI/test/vtkSplatterPlotFactoryTest.h
Expand Up @@ -45,13 +45,6 @@ class vtkSplatterPlotFactoryTest : public CxxTest::TestSuite
TSM_ASSERT_THROWS("This is a NULL workspace. Should throw.", factory.initialize( Workspace_sptr(ws) ), std::invalid_argument);
}

void testInitializeWithWrongWorkspaceTypeThrows()
{
IMDWorkspace* ws = new MockIMDWorkspace;
vtkSplatterPlotFactory factory(ThresholdRange_scptr(new UserDefinedThresholdRange(0, 1)), "signal");
TSM_ASSERT_THROWS("This is an invalid workspace. Should throw.", factory.initialize( Workspace_sptr(ws) ), std::invalid_argument);
}

/*Demonstrative tests*/

void test_3DWorkspace()
Expand Down
Expand Up @@ -126,7 +126,7 @@ protected slots:
QHBoxLayout *viewLayout; ///< Layout manager for the view widget
pqViewSettingsReaction *viewSettings; ///< Holder for the view settings reaction
bool viewSwitched;
ModeControlWidget::Views initialView; ///< Holds the initial view
ModeControlWidget::Views initialView; ///< Holds the initial view


/// Check the environmental variables.
Expand Down Expand Up @@ -163,18 +163,18 @@ protected slots:
void swapViews();
/// Update the state of application widgets.
void updateAppState();
/// Get the initial view for the current workspace and user setting
ModeControlWidget::Views getInitialView(int workspaceType, std::string instrumentName);
/// Get the initial view for the current workspace and user setting
ModeControlWidget::Views getInitialView(int workspaceType, std::string instrumentName);
/// Check that the view is valid for teh workspace type
ModeControlWidget::Views checkViewAgainstWorkspace(ModeControlWidget::Views view, int workspaceType);
/// Get the technique associated with an instrument.
const std::string getTechniqueForInstrument(const std::string& instrumentName) const;
/// Get the view for a specified instrument
std::string getViewForInstrument(const std::string& instrument) const;
/// Check if a technique contains a keyword
bool checkIfTechniqueContainsKeyword(const std::set<std::string>& techniques, const std::string& keyword) const;
/// Reset the current view to the appropriate initial view.
void resetCurrentView(int workspaceType, const std::string& instrumentName);
ModeControlWidget::Views checkViewAgainstWorkspace(ModeControlWidget::Views view, int workspaceType);
/// Get the technique associated with an instrument.
const std::string getTechniqueForInstrument(const std::string& instrumentName) const;
/// Get the view for a specified instrument
std::string getViewForInstrument(const std::string& instrument) const;
/// Check if a technique contains a keyword
bool checkIfTechniqueContainsKeyword(const std::set<std::string>& techniques, const std::string& keyword) const;
/// Reset the current view to the appropriate initial view.
void resetCurrentView(int workspaceType, const std::string& instrumentName);
};

} // SimpleGui
Expand Down
Expand Up @@ -219,6 +219,7 @@ void MdViewerWidget::setupMainView()

// Set the view at startup to STANDARD, the view will be changed, depending on the workspace
this->currentView = this->setMainViewWidget(this->ui.viewWidget, ModeControlWidget::STANDARD);
this->initialView = ModeControlWidget::STANDARD;
this->currentView->installEventFilter(this);

// Create a layout to manage the view properly
Expand Down Expand Up @@ -696,6 +697,7 @@ void MdViewerWidget::setupPluginMode()
this->setupMainView();
}


/**
* This function tells the current view to render the data, perform any
* necessary checks on the view given the workspace type and update the
Expand Down Expand Up @@ -774,6 +776,7 @@ void MdViewerWidget::switchViews(ModeControlWidget::Views v)
this->currentView->setColorsForView();
this->currentView->checkViewOnSwitch();
this->updateAppState();
this->initialView = v;
}

/**
Expand Down

0 comments on commit d2b904c

Please sign in to comment.