Skip to content

Commit

Permalink
MRG: Don't overwrite Report.fname upon saving (#9998) (#10066)
Browse files Browse the repository at this point in the history
* Don't overwrite Report.fname upon saving

* Add changelog entry

* Fix pickling

Co-authored-by: Richard Höchenberger <richard.hoechenberger@gmail.com>
  • Loading branch information
hoechenberger authored Dec 1, 2021
1 parent ffdac14 commit 7b5c61c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions doc/changes/0.24.inc
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ Version 0.24.1 (2021-12-01)

- Fix automatic channel type detection from channel labels in :func:`mne.io.read_raw_edf` and :func:`mne.io.read_raw_bdf` (and disable this functionality from :func:`mne.io.read_raw_gdf`) (:gh:`10058` by `Clemens Brunner`_)

- When opening a saved report and saving it to a different filename again, don't change ``Report.fname`` to avoid a regression when using :func:`~mne.open_report` as a context manager (:gh:`9998` by `Marijn van Vliet`_)

.. _changes_0_24_0:

Version 0.24.0 (2021-11-03)
Expand Down
6 changes: 4 additions & 2 deletions mne/report/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,8 @@ def _get_state_params():
return (
'baseline', 'cov_fname', 'include', '_content', 'image_format',
'info_fname', '_dom_id', 'raw_psd', 'projs',
'subjects_dir', 'subject', 'title', 'data_path', 'lang', 'verbose'
'subjects_dir', 'subject', 'title', 'data_path', 'lang', 'verbose',
'fname'
)

def _get_dom_id(self):
Expand Down Expand Up @@ -2843,7 +2844,8 @@ def save(self, fname=None, open_browser=True, overwrite=False,
if open_browser and not is_hdf5 and not building_doc:
webbrowser.open_new_tab('file://' + fname)

self.fname = fname
if self.fname is None:
self.fname = fname
return fname

def __enter__(self):
Expand Down

0 comments on commit 7b5c61c

Please sign in to comment.