From 8ba7b3cae42708e2cdb1fe02e017958f2c493ab7 Mon Sep 17 00:00:00 2001 From: MialLewis <95620982+MialLewis@users.noreply.github.com> Date: Fri, 17 Jun 2022 14:18:03 +0100 Subject: [PATCH] seperate toggle_waterfalls into two functions #REF793 --- mslice/plotting/plot_window/cut_plot.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/mslice/plotting/plot_window/cut_plot.py b/mslice/plotting/plot_window/cut_plot.py index 6856981b0..cab1b6e68 100644 --- a/mslice/plotting/plot_window/cut_plot.py +++ b/mslice/plotting/plot_window/cut_plot.py @@ -83,8 +83,8 @@ def setup_connections(self, plot_window): plot_window.action_gen_script.triggered.connect(self.generate_script) plot_window.action_gen_script_clipboard.triggered.connect(lambda: self.generate_script(clipboard=True)) plot_window.action_waterfall.triggered.connect(self.toggle_waterfall) - plot_window.waterfall_x_edt.editingFinished.connect(self.toggle_waterfall) - plot_window.waterfall_y_edt.editingFinished.connect(self.toggle_waterfall) + plot_window.waterfall_x_edt.editingFinished.connect(self.update_waterfall) + plot_window.waterfall_y_edt.editingFinished.connect(self.update_waterfall) plot_window.waterfall_x_edt.editingFinished.connect(plot_window.lose_waterfall_x_edt_focus) plot_window.waterfall_y_edt.editingFinished.connect(plot_window.lose_waterfall_y_edt_focus) plot_window.action_aluminium.triggered.connect( @@ -442,13 +442,16 @@ def get_line_visible(self, line_index: int) -> bool: return line_visible def toggle_waterfall(self): + self._datum_dirty = True + self.update_bragg_peaks(refresh=True) + self.update_waterfall() + + def update_waterfall(self): if self.waterfall: self._apply_offset(self.plot_window.waterfall_x, self.plot_window.waterfall_y) else: self._apply_offset(0., 0.) - self._datum_dirty = True - self.update_bragg_peaks(refresh=True) self._canvas.draw() def _cache_line(self, line): @@ -492,8 +495,8 @@ def on_newplot(self, ax, plot_over): if line not in self._waterfall_cache: self._waterfall_cache[line] = [line.get_xdata(), line.get_ydata()] new_line = True - if new_line and num_lines > 1: - self.toggle_waterfall() + if new_line and num_lines > 1 and self.plot_window.waterfall: + self.update_waterfall() self._datum_dirty = True self.update_bragg_peaks(refresh=True)