Commit 680c9e05 authored by Mathieu Tillet's avatar Mathieu Tillet
Browse files

Fix minor bugs

parent 90ff8954
...@@ -81,6 +81,7 @@ InstrumentWidgetMaskTab::InstrumentWidgetMaskTab(InstrumentWidget *instrWidget) ...@@ -81,6 +81,7 @@ InstrumentWidgetMaskTab::InstrumentWidgetMaskTab(InstrumentWidget *instrWidget)
m_doubleManager(nullptr), m_browser(nullptr), m_left(nullptr), m_doubleManager(nullptr), m_browser(nullptr), m_left(nullptr),
m_top(nullptr), m_right(nullptr), m_bottom(nullptr) { m_top(nullptr), m_right(nullptr), m_bottom(nullptr) {
m_detectorsToGroup = QList<Mantid::detid_t>();
// main layout // main layout
QVBoxLayout *layout = new QVBoxLayout(this); QVBoxLayout *layout = new QVBoxLayout(this);
...@@ -455,6 +456,7 @@ void InstrumentWidgetMaskTab::selectTool(Activity tool) { ...@@ -455,6 +456,7 @@ void InstrumentWidgetMaskTab::selectTool(Activity tool) {
void InstrumentWidgetMaskTab::setActivity() { void InstrumentWidgetMaskTab::setActivity() {
const QColor borderColor = getShapeBorderColor(); const QColor borderColor = getShapeBorderColor();
const QColor fillColor = getShapeFillColor(); const QColor fillColor = getShapeFillColor();
// m_detectorsToGroup.clear();
QString whatIsBeingSelected = m_maskBins && getMode() == Mode::Mask QString whatIsBeingSelected = m_maskBins && getMode() == Mode::Mask
? "Selecting bins" ? "Selecting bins"
: "Selecting detectors"; : "Selecting detectors";
...@@ -522,6 +524,7 @@ void InstrumentWidgetMaskTab::setActivity() { ...@@ -522,6 +524,7 @@ void InstrumentWidgetMaskTab::setActivity() {
m_activeTool->setText("Tool: Tube/bank mask. " + whatIsBeingSelected); m_activeTool->setText("Tool: Tube/bank mask. " + whatIsBeingSelected);
} }
m_instrWidget->updateInfoText(); m_instrWidget->updateInfoText();
// enableApplyButtons();
} }
/** /**
...@@ -554,7 +557,6 @@ void InstrumentWidgetMaskTab::singlePixelPicked(size_t pickID) { ...@@ -554,7 +557,6 @@ void InstrumentWidgetMaskTab::singlePixelPicked(size_t pickID) {
Mantid::detid_t detId = actor.getDetID(pickID); Mantid::detid_t detId = actor.getDetID(pickID);
m_detectorsToGroup.clear(); m_detectorsToGroup.clear();
m_detectorsToGroup.append(detId); m_detectorsToGroup.append(detId);
} else if (m_tube->isChecked()) { } else if (m_tube->isChecked()) {
if (!componentInfo.hasParent(pickID)) { if (!componentInfo.hasParent(pickID)) {
return; return;
...@@ -768,6 +770,7 @@ void InstrumentWidgetMaskTab::applyMaskToView() { ...@@ -768,6 +770,7 @@ void InstrumentWidgetMaskTab::applyMaskToView() {
*/ */
void InstrumentWidgetMaskTab::clearMask() { void InstrumentWidgetMaskTab::clearMask() {
clearShapes(); clearShapes();
m_detectorsToGroup.clear();
m_instrWidget->getInstrumentActor().clearMasks(); m_instrWidget->getInstrumentActor().clearMasks();
m_instrWidget->updateInstrumentView(); m_instrWidget->updateInstrumentView();
enableApplyButtons(); enableApplyButtons();
...@@ -1146,7 +1149,7 @@ void InstrumentWidgetMaskTab::enableApplyButtons() { ...@@ -1146,7 +1149,7 @@ void InstrumentWidgetMaskTab::enableApplyButtons() {
bool hasBinMask = instrActor.hasBinMask(); bool hasBinMask = instrActor.hasBinMask();
bool hasDetectorMask = hasMaskShapes || hasMaskWorkspace; bool hasDetectorMask = hasMaskShapes || hasMaskWorkspace;
bool hasMask = hasDetectorMask || hasBinMask; bool hasMask = hasDetectorMask || hasBinMask;
bool canGroup = (m_detectorsToGroup.size() != 0) && (mode == Mode::Group);
bool enableBinMasking = hasMaskShapes && m_maskBins && mode == Mode::Mask; bool enableBinMasking = hasMaskShapes && m_maskBins && mode == Mode::Mask;
if (m_maskBins && mode == Mode::Mask) { if (m_maskBins && mode == Mode::Mask) {
...@@ -1164,8 +1167,9 @@ void InstrumentWidgetMaskTab::enableApplyButtons() { ...@@ -1164,8 +1167,9 @@ void InstrumentWidgetMaskTab::enableApplyButtons() {
m_applyToView->setEnabled(false); m_applyToView->setEnabled(false);
} }
m_saveShapesToTable->setEnabled(hasMaskShapes); m_saveShapesToTable->setEnabled(hasMaskShapes);
m_saveButton->setEnabled(hasDetectorMask && (!enableBinMasking)); m_saveButton->setEnabled((hasDetectorMask || canGroup) &&
m_clearAll->setEnabled(hasMask); (!enableBinMasking));
m_clearAll->setEnabled(hasMask || canGroup);
setActivity(); setActivity();
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment