Skip to content

Commit

Permalink
BUG: (temporarily) fix MouseMove-Bug on windows (#141)
Browse files Browse the repository at this point in the history
* circumvent PyQt-Bug on windows

* change platform-recognition
  • Loading branch information
marsipu authored Aug 27, 2022
1 parent 1096265 commit 57b1148
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions mne_qt_browser/_pg_figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -1059,7 +1059,14 @@ def mousePressEvent(self, event):

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

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

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

0 comments on commit 57b1148

Please sign in to comment.