Skip to content

Commit 0984be2

Browse files
Make Inspector work even if mne-qt-browser is installed (#1007)
We now explicitly request a Matploblib plotting context for bringing up the Inspector. Otherwise, our MNE will default to using the qt-browser, and our current implementation of the Inspector will fail to launch.
1 parent 14dde85 commit 0984be2

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

doc/whats_new.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ Detailed list of changes
6161

6262
- Suppress superfluous warnings about MaxShield in many functions when handling Elekta/Neuromag/MEGIN data, by `Richard Höchenberger`_ (:gh:`1000`)
6363

64+
- The MNE-BIDS Inspector didn't work if ``mne-qt-browser`` was installed and used as the default plotting backend, as the Inspector currently only supports the Matplotlib backend, by `Richard Höchenberger`_ (:gh:`1007`)
65+
6466
:doc:`Find out what was new in previous releases <whats_new_previous_releases>`
6567

6668
.. include:: authors.rst

mne_bids/inspect.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
from mne.utils import logger, verbose
1414
from mne.fixes import _compare_version
15+
from mne.viz import use_browser_backend
1516

1617
if _compare_version(mne.__version__, '<', '1.0.dev0'): # pragma: no cover
1718
from mne.preprocessing import annotate_flat
@@ -155,10 +156,14 @@ def _inspect_raw(*, bids_path, l_freq, h_freq, find_flat, show_annotations):
155156
flat_chans = []
156157

157158
show_options = bids_path.datatype == 'meg'
158-
fig = raw.plot(title=f'{bids_path.root.name}: {bids_path.basename}',
159-
highpass=l_freq, lowpass=h_freq,
160-
show_options=show_options,
161-
block=False, show=False, verbose='warning')
159+
160+
with use_browser_backend('matplotlib'):
161+
fig = raw.plot(
162+
title=f'{bids_path.root.name}: {bids_path.basename}',
163+
highpass=l_freq, lowpass=h_freq,
164+
show_options=show_options,
165+
block=False, show=False, verbose='warning'
166+
)
162167

163168
# Add our own event handlers so that when the MNE Raw Browser is being
164169
# closed, our dialog box will pop up, asking whether to save changes.

0 commit comments

Comments
 (0)