Skip to content

Commit

Permalink
Re #5366. Ability to connect not checked in validateInputs().
Browse files Browse the repository at this point in the history
Repeatedly connecting/disconnecting every time validateInputs was
called is undesirable. We can now create a listener without
connecting (#6553), so we can still check whether this is asking to
add histograms together.
  • Loading branch information
RussellTaylor committed Feb 11, 2013
1 parent a8caf15 commit c091e9a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 11 deletions.
12 changes: 3 additions & 9 deletions Code/Mantid/Framework/DataHandling/src/LiveDataAlgorithm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,16 +287,10 @@ namespace DataHandling
std::map<std::string, std::string> out;

const std::string instrument = getPropertyValue("Instrument");
try {
const bool eventListener = LiveListenerFactory::Instance().create(instrument,false)->buffersEvents();
if ( !eventListener && getPropertyValue("AccumulationMethod") == "Add" )
{
out["AccumulationMethod"] = "The " + instrument + " live stream produces histograms. Add is not a sensible accumulation method.";
}
}
catch ( std::runtime_error& )
const bool eventListener = LiveListenerFactory::Instance().create(instrument,false)->buffersEvents();
if ( !eventListener && getPropertyValue("AccumulationMethod") == "Add" )
{
out["Instrument"] = "Unable to connect to live stream for " + instrument;
out["AccumulationMethod"] = "The " + instrument + " live stream produces histograms. Add is not a sensible accumulation method.";
}

if (this->getPropertyValue("OutputWorkspace").empty())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ class LiveDataAlgorithmTest : public CxxTest::TestSuite
TS_ASSERT( alg.isInitialized() )
TS_ASSERT( !alg.hasPostProcessing() );

TSM_ASSERT("Can't connect", !alg.validateInputs()["Instrument"].empty() );
alg.setPropertyValue("Instrument","FakeEventDataListener");

TSM_ASSERT("No OutputWorkspace", !alg.validateInputs()["OutputWorkspace"].empty() );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ void StartLiveDataDialog::initLayout()

// ========== Set previous values from history =============
fillAndSetComboBox("Instrument", ui.cmbInstrument);
tie(ui.cmbInstrument, "Instrument", ui.horizontalLayout_5);
tie(ui.edtUpdateEvery, "UpdateEvery", ui.layoutUpdateEvery);
fillAndSetComboBox("AccumulationMethod", ui.cmbAccumulationMethod);

Expand Down

0 comments on commit c091e9a

Please sign in to comment.