Skip to content

Commit 9a47e8e

Browse files
wmvanvlietagramfort
authored andcommitted
Use title of slider in HTML report menu (#6149)
* Use title of slider in HTML report menu * Test removing sliders
1 parent b147676 commit 9a47e8e

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

mne/report.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1321,7 +1321,7 @@ class construction.
13211321
slider_klass = sectionvar
13221322

13231323
self._add_or_replace(
1324-
'%s-#-%s-#-custom' % (section, sectionvar), sectionvar,
1324+
'%s-#-%s-#-custom' % (title, sectionvar), sectionvar,
13251325
slider_full_template.substitute(id=global_id, title=title,
13261326
div_klass=slider_klass,
13271327
slider_id=slider_id, html=html,

mne/tests/test_report.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,8 @@ def test_add_slider_to_section():
279279
subject='sample', subjects_dir=subjects_dir)
280280
section = 'slider_section'
281281
figs = _get_example_figures()
282-
report.add_slider_to_section(figs, section=section)
282+
report.add_slider_to_section(figs, section=section, title='my title')
283+
assert report.fnames[0] == 'my title-#-report_slider_section-#-custom'
283284
report.save(op.join(tempdir, 'report.html'), open_browser=False)
284285

285286
pytest.raises(NotImplementedError, report.add_slider_to_section,
@@ -348,7 +349,8 @@ def test_remove():
348349
r = Report()
349350
fig1, fig2 = _get_example_figures()
350351
r.add_figs_to_section(fig1, 'figure1', 'mysection')
351-
r.add_figs_to_section(fig1, 'figure1', 'othersection')
352+
r.add_slider_to_section([fig1, fig2], title='figure1',
353+
section='othersection')
352354
r.add_figs_to_section(fig2, 'figure1', 'mysection')
353355
r.add_figs_to_section(fig2, 'figure2', 'mysection')
354356

0 commit comments

Comments
 (0)