diff --git a/qt/scientific_interfaces/Muon/MuonAnalysis.cpp b/qt/scientific_interfaces/Muon/MuonAnalysis.cpp index 4fb92f80dbf3e040b640069f1108cea4e020507e..aeb0fdd3098b1494214d31fe93bc4164668afbe7 100644 --- a/qt/scientific_interfaces/Muon/MuonAnalysis.cpp +++ b/qt/scientific_interfaces/Muon/MuonAnalysis.cpp @@ -1975,28 +1975,30 @@ bool MuonAnalysis::plotExists(const QString &wsName) { */ void MuonAnalysis::selectMultiPeak(const QString &wsName, const boost::optional<QString> &filePath) { + disableAllTools(); if (!plotExists(wsName)) { plotSpectrum(wsName); setCurrentDataName(wsName); } - - if (wsName != m_fitDataPresenter->getAssignedFirstRun()) { - // Set the available groups/pairs and periods - const Grouping groups = m_groupingHelper.parseGroupingTable(); - QStringList groupsAndPairs; - groupsAndPairs.reserve( - static_cast<int>(groups.groupNames.size() + groups.pairNames.size())); - std::transform(groups.groupNames.begin(), groups.groupNames.end(), - std::back_inserter(groupsAndPairs), &QString::fromStdString); - std::transform(groups.pairNames.begin(), groups.pairNames.end(), - std::back_inserter(groupsAndPairs), &QString::fromStdString); - setGroupsAndPairs(); - - // Set the selected run, group/pair and period - m_fitDataPresenter->setAssignedFirstRun(wsName, filePath); - setChosenGroupAndPeriods(wsName); - } + // go from MUSR data (after a fit) to HIFI 84447 to see errors... + // move the below code to be after load??? + if (wsName != m_fitDataPresenter->getAssignedFirstRun()) { + // Set the available groups/pairs and periods + const Grouping groups = m_groupingHelper.parseGroupingTable(); + QStringList groupsAndPairs; + groupsAndPairs.reserve( + static_cast<int>(groups.groupNames.size() + groups.pairNames.size())); + std::transform(groups.groupNames.begin(), groups.groupNames.end(), + std::back_inserter(groupsAndPairs), &QString::fromStdString); + std::transform(groups.pairNames.begin(), groups.pairNames.end(), + std::back_inserter(groupsAndPairs), &QString::fromStdString); + setGroupsAndPairs(); + + // Set the selected run, group/pair and period + m_fitDataPresenter->setAssignedFirstRun(wsName, filePath); + setChosenGroupAndPeriods(wsName); + } QString code; diff --git a/qt/widgets/common/src/MuonFitPropertyBrowser.cpp b/qt/widgets/common/src/MuonFitPropertyBrowser.cpp index b20a7f817c648dc0f87ba56ff1a3af20dc7313b8..f816eef1fdf4ed077af06f5ad3d49eb7f0735e71 100644 --- a/qt/widgets/common/src/MuonFitPropertyBrowser.cpp +++ b/qt/widgets/common/src/MuonFitPropertyBrowser.cpp @@ -406,10 +406,11 @@ void MuonFitPropertyBrowser::enumChanged(QtProperty *prop) { } updatePeriodDisplay(); } else if (prop == m_workspace) { - // make sure the output is updated - FitPropertyBrowser::enumChanged(prop); int j = m_enumManager->value(m_workspace); std::string option = m_workspaceNames[j].toStdString(); + //update plot + emit workspaceNameChanged(QString::fromStdString(option)); + setOutputName(option); // only do this if in single fit mode if (m_periodBoxes.size() > 1 && @@ -429,6 +430,30 @@ void MuonFitPropertyBrowser::enumChanged(QtProperty *prop) { m_boolManager->setValue(iter.value(), selectedPeriod == iter.key()); } } + if (!m_browser->isItemVisible(m_multiFitSettingsGroup)) { + size_t end = 0; + // assumed structure of name + // isolate the group/pair + for (int k = 0; k < 2; k++) { + end = option.find_first_of(";"); + option = option.substr(end + 1, option.size()); + } + end = option.find_first_of(";"); + + boost::erase_all(option, " "); + + auto tmp = option.substr(0, end-1); + QString selectedGroup = QString::fromStdString(tmp); + // turn on only the relevant box + for (auto iter = m_groupBoxes.constBegin(); + iter != m_groupBoxes.constEnd(); ++iter) { + auto a = selectedGroup.toStdString(); + auto b = iter.key().toStdString(); + auto c = selectedGroup == iter.key(); + m_boolManager->setValue(iter.value(), selectedGroup == iter.key()); + } + } + } else { FitPropertyBrowser::enumChanged(prop); }