Skip to content

Commit 57b1148

Browse files
authored
BUG: (temporarily) fix MouseMove-Bug on windows (#141)
* circumvent PyQt-Bug on windows * change platform-recognition
1 parent 1096265 commit 57b1148

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

mne_qt_browser/_pg_figure.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,7 +1059,14 @@ def mousePressEvent(self, event):
10591059

10601060
def mouseMoveEvent(self, event):
10611061
"""Customize mouse move events."""
1062-
self._set_range_from_pos(event.pos())
1062+
# This temporarily circumvents a bug, which only appears on windows
1063+
# and when pyqt>=5.14.2 is installed from conda-forge.
1064+
# It leads to receiving mouseMoveEvents all the time when the Mouse
1065+
# is moved through the OverviewBar, even when now MouseBUtton is
1066+
# pressed. Dragging the mouse on OverviewBar is then
1067+
# not possible anymore.
1068+
if not platform.system() == 'Windows':
1069+
self._set_range_from_pos(event.pos())
10631070

10641071
def _fit_bg_img(self):
10651072
# Remove previous item from scene
@@ -2890,7 +2897,7 @@ def _hidpi_mkPen(*args, **kwargs):
28902897
if self.mne.use_opengl is None: # default: opt-in
28912898
# OpenGL needs to be enabled on macOS
28922899
# (https://github.com/mne-tools/mne-qt-browser/issues/53)
2893-
default = 'true' if sys.platform == 'darwin' else ''
2900+
default = 'true' if platform.system() == 'Darwin' else ''
28942901
config_val = get_config(opengl_key, default).lower()
28952902
self.mne.use_opengl = (config_val == 'true')
28962903

@@ -2902,7 +2909,7 @@ def _hidpi_mkPen(*args, **kwargs):
29022909
# it can lead to segfaults. If a user really knows what they
29032910
# are doing, they can pass use_opengl=False (or set
29042911
# MNE_BROWSER_USE_OPENGL=false)
2905-
if sys.platform == 'darwin':
2912+
if platform.system() == 'Darwin':
29062913
raise RuntimeError(
29072914
'Plotting on macOS without OpenGL may be unstable! '
29082915
'We recommend installing PyOpenGL, but it could not '

0 commit comments

Comments
 (0)