diff --git a/src/mslice/plotting/plot_window/interactive_cut.py b/src/mslice/plotting/plot_window/interactive_cut.py index bed39920..4acc6e2f 100644 --- a/src/mslice/plotting/plot_window/interactive_cut.py +++ b/src/mslice/plotting/plot_window/interactive_cut.py @@ -160,7 +160,7 @@ def flip_axis(self): self.plot_cut(*self.rect.extents) def window_closing(self): - self.slice_plot.toggle_interactive_cuts(False) + self.slice_plot.toggle_interactive_cuts() self.slice_plot.plot_window.action_interactive_cuts.setChecked(False) def refresh_rect_selector(self, ax): diff --git a/src/mslice/plotting/plot_window/slice_plot.py b/src/mslice/plotting/plot_window/slice_plot.py index aa1073ea..55a8ee35 100644 --- a/src/mslice/plotting/plot_window/slice_plot.py +++ b/src/mslice/plotting/plot_window/slice_plot.py @@ -520,11 +520,11 @@ def _update_lines(self): self.update_legend() self._canvas.draw() - def toggle_interactive_cuts(self, store=True): - self.toggle_icut_button(store) + def toggle_interactive_cuts(self): + self.toggle_icut_button() self.toggle_icut() - def toggle_icut_button(self, store=True): + def toggle_icut_button(self): if not self.icut: self.manager.picking_connected(False) if self.plot_window.action_zoom_in.isChecked(): @@ -545,7 +545,7 @@ def toggle_icut_button(self, store=True): self.plot_window.action_flip_axis.setVisible(False) self._canvas.setCursor(Qt.ArrowCursor) self.icut.set_icut_intensity_category(self.intensity_type) - self.icut.store_icut_cut_upon_toggle_and_reset(store) + self.icut.store_icut_cut_upon_toggle_and_reset(True) self.plot_window.menu_intensity.setDisabled(False) def toggle_icut(self): diff --git a/src/mslice/presenters/cut_plotter_presenter.py b/src/mslice/presenters/cut_plotter_presenter.py index 2b3f876a..c8eb0d8d 100644 --- a/src/mslice/presenters/cut_plotter_presenter.py +++ b/src/mslice/presenters/cut_plotter_presenter.py @@ -9,7 +9,10 @@ from mslice.models.cut.cut_functions import compute_cut from mslice.models.labels import generate_legend from mslice.models.workspacemanager.workspace_algorithms import export_workspace_to_ads -from mslice.models.workspacemanager.workspace_provider import get_workspace_handle +from mslice.models.workspacemanager.workspace_provider import ( + add_workspace, + get_workspace_handle, +) import mslice.plotting.pyplot as plt from mslice.presenters.presenter_utility import PresenterUtility from mslice.plotting.plot_window.overplot_interface import ( @@ -18,7 +21,6 @@ ) from mslice.models.powder.powder_functions import compute_powder_line from mslice.models.intensity_correction_algs import sample_temperature -from mslice.models.workspacemanager.workspace_provider import add_workspace from mslice.models.axis import Axis from mslice.util.intensity_correction import IntensityType, IntensityCache import warnings @@ -350,24 +352,40 @@ def _show_intensity(self, cut_cache, intensity_correction): self._temp_cut_cache = [] def show_scattering_function(self, axes): - self._show_intensity( - self._cut_cache_dict[axes], IntensityType.SCATTERING_FUNCTION - ) + for key, value in self._cut_cache_dict.items(): + if key == axes: + self._show_intensity(value, IntensityType.SCATTERING_FUNCTION) + break def show_dynamical_susceptibility(self, axes): - self._show_intensity(self._cut_cache_dict[axes], IntensityType.CHI) + for key, value in self._cut_cache_dict.items(): + if key == axes: + self._show_intensity(value, IntensityType.CHI) + break def show_dynamical_susceptibility_magnetic(self, axes): - self._show_intensity(self._cut_cache_dict[axes], IntensityType.CHI_MAGNETIC) + for key, value in self._cut_cache_dict.items(): + if key == axes: + self._show_intensity(value, IntensityType.CHI_MAGNETIC) + break def show_d2sigma(self, axes): - self._show_intensity(self._cut_cache_dict[axes], IntensityType.D2SIGMA) + for key, value in self._cut_cache_dict.items(): + if key == axes: + self._show_intensity(value, IntensityType.D2SIGMA) + break def show_symmetrised(self, axes): - self._show_intensity(self._cut_cache_dict[axes], IntensityType.SYMMETRISED) + for key, value in self._cut_cache_dict.items(): + if key == axes: + self._show_intensity(value, IntensityType.SYMMETRISED) + break def show_gdos(self, axes): - self._show_intensity(self._cut_cache_dict[axes], IntensityType.GDOS) + for key, value in self._cut_cache_dict.items(): + if key == axes: + self._show_intensity(value, IntensityType.GDOS) + break def set_sample_temperature(self, axes, ws_name, temp): cut_dict = {}