mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
Plot widget: Fix plot selection crash on mouse wheel events
This commit is contained in:
1 parent
40b48a2080
commit
17792ec995
5 files changed
+12
-7
No files matched your search
@@ -20,6 +20,7 @@ import logging
|
|||||||
|
|
||||||
from tools import timer
|
from tools import timer
|
||||||
from View.Tools.PamhyrPlot import PamhyrPlot
|
from View.Tools.PamhyrPlot import PamhyrPlot
|
||||||
|
from matplotlib.backend_bases import MouseButton
|
||||||
from PyQt5.QtWidgets import QApplication
|
from PyQt5.QtWidgets import QApplication
|
||||||
from PyQt5.QtCore import (
|
from PyQt5.QtCore import (
|
||||||
Qt, QItemSelectionModel,
|
Qt, QItemSelectionModel,
|
||||||
@@ -64,7 +65,7 @@ class PlotRKZ(PamhyrPlot):
|
|||||||
def onpick(self, event):
|
def onpick(self, event):
|
||||||
if event.mouseevent.inaxes != self.canvas.axes:
|
if event.mouseevent.inaxes != self.canvas.axes:
|
||||||
return
|
return
|
||||||
if event.mouseevent.button.value != 1:
|
if event.mouseevent.button != MouseButton.LEFT:
|
||||||
return
|
return
|
||||||
|
|
||||||
modifiers = QApplication.keyboardModifiers()
|
modifiers = QApplication.keyboardModifiers()
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
from tools import timer, trace
|
from tools import timer, trace
|
||||||
from View.Tools.PamhyrPlot import PamhyrPlot
|
from View.Tools.PamhyrPlot import PamhyrPlot
|
||||||
|
from matplotlib.backend_bases import MouseButton
|
||||||
from matplotlib import collections
|
from matplotlib import collections
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
@@ -60,7 +61,7 @@ class PlotXY(PamhyrPlot):
|
|||||||
def onpick(self, event):
|
def onpick(self, event):
|
||||||
if event.mouseevent.inaxes != self.canvas.axes:
|
if event.mouseevent.inaxes != self.canvas.axes:
|
||||||
return
|
return
|
||||||
if event.mouseevent.button.value != 1:
|
if event.mouseevent.button != MouseButton.LEFT:
|
||||||
return
|
return
|
||||||
|
|
||||||
modifiers = QApplication.keyboardModifiers()
|
modifiers = QApplication.keyboardModifiers()
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ from math import dist, sqrt
|
|||||||
|
|
||||||
from tools import timer, trace
|
from tools import timer, trace
|
||||||
from View.Tools.PamhyrPlot import PamhyrPlot
|
from View.Tools.PamhyrPlot import PamhyrPlot
|
||||||
|
from matplotlib.backend_bases import MouseButton
|
||||||
|
|
||||||
from PyQt5.QtCore import (
|
from PyQt5.QtCore import (
|
||||||
Qt, QCoreApplication, QItemSelectionModel,
|
Qt, QCoreApplication, QItemSelectionModel,
|
||||||
@@ -111,7 +112,7 @@ class Plot(PamhyrPlot):
|
|||||||
def onpick(self, event):
|
def onpick(self, event):
|
||||||
if event.mouseevent.inaxes != self.canvas.axes:
|
if event.mouseevent.inaxes != self.canvas.axes:
|
||||||
return
|
return
|
||||||
if event.mouseevent.button.value != 1:
|
if event.mouseevent.button != MouseButton.LEFT:
|
||||||
return
|
return
|
||||||
|
|
||||||
modifiers = QApplication.keyboardModifiers()
|
modifiers = QApplication.keyboardModifiers()
|
||||||
@@ -126,11 +127,11 @@ class Plot(PamhyrPlot):
|
|||||||
def onclick(self, event):
|
def onclick(self, event):
|
||||||
if event.inaxes != self.canvas.axes:
|
if event.inaxes != self.canvas.axes:
|
||||||
return
|
return
|
||||||
if event.button.value == 1:
|
if event.button not in (MouseButton.MIDDLE, MouseButton.RIGHT):
|
||||||
return
|
return
|
||||||
|
|
||||||
z = self._get_z_from_click(event)
|
z = self._get_z_from_click(event)
|
||||||
if z < self.data.z_min() or event.button.value == 2:
|
if z < self.data.z_min() or event.button == MouseButton.MIDDLE:
|
||||||
self.highlight = None
|
self.highlight = None
|
||||||
self.draw_highligth()
|
self.draw_highligth()
|
||||||
self.update_idle()
|
self.update_idle()
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
from tools import timer
|
from tools import timer
|
||||||
from View.Tools.PamhyrPlot import PamhyrPlot
|
from View.Tools.PamhyrPlot import PamhyrPlot
|
||||||
|
from matplotlib.backend_bases import MouseButton
|
||||||
|
|
||||||
from PyQt5.QtCore import (
|
from PyQt5.QtCore import (
|
||||||
QCoreApplication, Qt,
|
QCoreApplication, Qt,
|
||||||
@@ -243,7 +244,7 @@ class PlotRKC(PamhyrPlot):
|
|||||||
def onpick(self, event):
|
def onpick(self, event):
|
||||||
if event.mouseevent.inaxes != self.canvas.axes:
|
if event.mouseevent.inaxes != self.canvas.axes:
|
||||||
return
|
return
|
||||||
if event.mouseevent.button.value != 1:
|
if event.mouseevent.button != MouseButton.LEFT:
|
||||||
return
|
return
|
||||||
|
|
||||||
modifiers = QApplication.keyboardModifiers()
|
modifiers = QApplication.keyboardModifiers()
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import numpy as np
|
|||||||
|
|
||||||
from tools import timer, trace, logger_exception
|
from tools import timer, trace, logger_exception
|
||||||
from View.Tools.PamhyrPlot import PamhyrPlot
|
from View.Tools.PamhyrPlot import PamhyrPlot
|
||||||
|
from matplotlib.backend_bases import MouseButton
|
||||||
from matplotlib import collections
|
from matplotlib import collections
|
||||||
|
|
||||||
from PyQt5.QtCore import (
|
from PyQt5.QtCore import (
|
||||||
@@ -89,7 +90,7 @@ class PlotXY(PamhyrPlot):
|
|||||||
def onpick(self, event):
|
def onpick(self, event):
|
||||||
if event.mouseevent.inaxes != self.canvas.axes:
|
if event.mouseevent.inaxes != self.canvas.axes:
|
||||||
return
|
return
|
||||||
if event.mouseevent.button.value != 1:
|
if event.mouseevent.button != MouseButton.LEFT:
|
||||||
return
|
return
|
||||||
|
|
||||||
modifiers = QApplication.keyboardModifiers()
|
modifiers = QApplication.keyboardModifiers()
|
||||||
|
|||||||
Reference in new issue
Block a user