Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion doc/sphinxext/mne_doc_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@
import numpy as np
import pyvista
import sphinx.util.logging
from sphinx.errors import ExtensionError

import mne
from mne.utils import (
_assert_no_instances,
_assert_no_instances as _assert_no_instances_mne,
)
from mne.utils import (
_get_extra_data_path,
sizeof_fmt,
)
Expand Down Expand Up @@ -104,6 +107,14 @@ def reset_warnings(gallery_conf, fname):
t0 = time.time()


def _assert_no_instances(cls, when):
"""Wrap our internal one but make the traceback nicer when it fails."""
try:
_assert_no_instances_mne(cls, when)
except Exception as exc:
raise ExtensionError(str(exc)) from None


def reset_modules(gallery_conf, fname, when):
"""Do the reset."""
import matplotlib.pyplot as plt
Expand Down
5 changes: 3 additions & 2 deletions mne/gui/_coreg.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import re
import threading
import time
import weakref
from contextlib import contextmanager
from functools import partial
from pathlib import Path
Expand Down Expand Up @@ -914,7 +915,7 @@ def _on_pick(self, vtk_picker, event):
mesh = vtk_picker.GetDataSet()
if mesh is None or cell_id == -1 or not self._mouse_no_mvt:
return
if not any(mesh is target for target in self._picking_targets):
if not any(mesh is target() for target in self._picking_targets):
return
pos = np.array(vtk_picker.GetPickPosition())
vtk_cell = mesh.GetCell(cell_id)
Expand Down Expand Up @@ -1342,7 +1343,7 @@ def _add_head_surface(self):
key = "low"
self._update_actor("head", head_actor)
# mark head surface mesh to restrict picking
self._picking_targets.append(head_surf)
self._picking_targets.append(weakref.ref(head_surf))
# We need to use _get_processed_mri_points to incorporate grow_hair
rr = self.coreg._get_processed_mri_points(key) * self.coreg._scale.T
head_surf.points = rr
Expand Down
Loading