From f5d2768f99ffd19cac41b8c907b62ccd6d398c5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=2E=20Armando=20Sol=C3=A9?= Date: Mon, 8 Nov 2021 15:23:17 +0100 Subject: [PATCH] Get rid of error in calibration when clicking on empty space after having selected a peak. --- PyMca5/PyMcaGraph/backends/MatplotlibBackend.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/PyMca5/PyMcaGraph/backends/MatplotlibBackend.py b/PyMca5/PyMcaGraph/backends/MatplotlibBackend.py index d6e426b82..f5bd435a2 100644 --- a/PyMca5/PyMcaGraph/backends/MatplotlibBackend.py +++ b/PyMca5/PyMcaGraph/backends/MatplotlibBackend.py @@ -2,7 +2,7 @@ # # The PyMca X-Ray Fluorescence Toolkit # -# Copyright (c) 2004-2020 European Synchrotron Radiation Facility +# Copyright (c) 2004-2021 European Synchrotron Radiation Facility # # This file is part of the PyMca X-ray Fluorescence Toolkit developed at # the ESRF by the Software group. @@ -639,7 +639,7 @@ def onMousePressed(self, event): xData, yData = artist._constraint(xData, yData) artist.set_xdata(xData) artist.set_ydata(yData) - if BLITTING: + if BLITTING and hasattr(artist.figure, "canvas"): canvas = artist.figure.canvas axes = artist.axes artist.set_animated(True) @@ -679,6 +679,8 @@ def onMousePressed(self, event): else: ddict['button'] = "right" self._callback(ddict) + if ddict['event'] == "markerClicked": + self.__picking = False return elif self._pickingInfo['type'] == "curve": ddict = {} @@ -1112,6 +1114,7 @@ def onMouseReleased(self, event): ddict['xdata'] = artist.get_xdata() ddict['ydata'] = artist.get_ydata() self._callback(ddict) + self._pickingInfo = {} return if not hasattr(self, "__zoomstack"):