From cf28aa9152806e0d34a93b5ee873faa56209bc9a Mon Sep 17 00:00:00 2001 From: Phil Colebrooke <philipc99@hotmail.co.uk> Date: Fri, 3 Apr 2020 15:43:57 +0100 Subject: [PATCH] Re #28464 make plot not move around after closing axis editor --- Framework/PythonInterface/mantid/plots/mantidaxes.py | 7 +++++++ .../workbench/workbench/plotting/figureinteraction.py | 3 +++ 2 files changed, 10 insertions(+) diff --git a/Framework/PythonInterface/mantid/plots/mantidaxes.py b/Framework/PythonInterface/mantid/plots/mantidaxes.py index a0300b72050..e0a8e8632dd 100644 --- a/Framework/PythonInterface/mantid/plots/mantidaxes.py +++ b/Framework/PythonInterface/mantid/plots/mantidaxes.py @@ -1128,6 +1128,13 @@ class MantidAxes3D(Axes3D): name = 'mantid3d' + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + + # Remove the connection for when you click on the plot as this is dealt with in figureinteraction.py to stop + # it interfering with double-clicking on the axes. + self.figure.canvas.mpl_disconnect(self._cids[1]) + def plot(self, *args, **kwargs): """ If the **mantid3d** projection is chosen, it can be diff --git a/qt/applications/workbench/workbench/plotting/figureinteraction.py b/qt/applications/workbench/workbench/plotting/figureinteraction.py index e24075cde1b..05979fb55db 100644 --- a/qt/applications/workbench/workbench/plotting/figureinteraction.py +++ b/qt/applications/workbench/workbench/plotting/figureinteraction.py @@ -20,6 +20,7 @@ from qtpy.QtGui import QCursor from qtpy.QtWidgets import QActionGroup, QMenu, QApplication from matplotlib.colors import LogNorm, Normalize from matplotlib.collections import Collection +from mpl_toolkits.mplot3d.axes3d import Axes3D # third party imports from mantid.api import AnalysisDataService as ads @@ -152,6 +153,8 @@ class FigureInteraction(object): self.canvas.toolbar.press_pan(event) finally: event.button = 3 + elif isinstance(event.inaxes, Axes3D): + event.inaxes._button_press(event) def on_mouse_button_release(self, event): """ Stop moving the markers when the mouse button is released """ -- GitLab