Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Enabled Surface Plotting from Single-Spectrum Workspaces
15 changes: 15 additions & 0 deletions qt/python/mantidqt/mantidqt/dialogs/spectraselectordialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,22 @@ def __init__(self, workspaces, parent=None, show_colorfill_btn=False, overplot=F
self._on_specnums_changed()
self._on_wkspindices_changed()

# Check if workspace only has a single spectra, if true set default value to 1
def check_num_spectra(self):
if not self._ui.specNums.text():
if any(ws.getNumberHistograms() == 1 for ws in self._workspaces):
self._ui.specNums.setText("1")
self._parse_spec_nums()

def on_ok_clicked(self):
self.check_num_spectra()

if self._check_number_of_plots(self.selection):
self.accept()

def on_plot_all_clicked(self):
self.check_num_spectra()

selection = SpectraSelection(self._workspaces)
selection.spectra = self._plottable_spectra
selection.plot_type = self._ui.plotType.currentIndex()
Expand Down Expand Up @@ -291,6 +302,10 @@ def _on_plot_type_changed(self, new_index):
self._ui.advanced_options_widget.ui.plot_axis_label_line_edit.setText(WORKSPACE_REFERENCE_NUMBER)

self._ui.buttonBox.button(QDialogButtonBox.YesToAll).setEnabled(False)

if self._ui.plotType.currentText() == SURFACE:
self._ui.buttonBox.button(QDialogButtonBox.YesToAll).setEnabled(True)

else:
self._ui.advanced_options_widget.ui.error_bars_check_box.setEnabled(True)
self._ui.advanced_options_widget.ui.plot_axis_label_line_edit.setEnabled(False)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ def test_plot_all_button_disabled_when_plot_type_is_surface(self):
workspaces = [self._single_spec_ws] * 3
ssd = SpectraSelectionDialog(workspaces, advanced=True)
ssd._ui.plotType.setCurrentIndex(3)
self.assertFalse(ssd._ui.buttonBox.button(QDialogButtonBox.YesToAll).isEnabled())
self.assertTrue(ssd._ui.buttonBox.button(QDialogButtonBox.YesToAll).isEnabled())

def test_plot_all_button_disabled_when_plot_type_is_contour(self):
workspaces = [self._single_spec_ws] * 3
Expand Down
Loading