Skip to content

Commit 844d53c

Browse files
MNT: Migrate to ipyvtklink (#9341)
* Update backend * Bump requirements * Bump requirements * Use zipball * Fix
1 parent ca991d8 commit 844d53c

File tree

8 files changed

+14
-29
lines changed

8 files changed

+14
-29
lines changed

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ For full functionality, some functions require:
104104
- CuPy >= 6.0.0 (for NVIDIA CUDA acceleration)
105105
- DIPY >= 1.0.0
106106
- Imageio >= 2.6.1
107-
- PyVista >= 0.24
108-
- pyvistaqt >= 0.2.0
107+
- PyVista >= 0.30
108+
- pyvistaqt >= 0.3.0
109109
- mffpy >= 0.5.7
110110

111111
Contributing to MNE-Python

environment.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ dependencies:
2323
- spyder-kernels>=1.10.0
2424
- imageio-ffmpeg>=0.4.1
2525
- vtk>=9.0.1
26-
- pyvista>=0.24
27-
- pyvistaqt>=0.2.0
26+
- pyvista>=0.30
2827
- qdarkstyle
2928
- darkdetect
3029
- mayavi
@@ -38,4 +37,5 @@ dependencies:
3837
- mffpy>=0.5.7
3938
- ipywidgets
4039
- pip:
41-
- ipyvtk-simple
40+
- ipyvtklink
41+
- https://api.github.com/repos/pyvista/pyvistaqt/zipball/8eb40405b31ef815527a2620bc395cb9c5548377

mne/viz/_brain/_brain.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1706,12 +1706,7 @@ def _clear_callbacks(self):
17061706
self.callbacks.clear()
17071707
# Remove the default key binding
17081708
if getattr(self, "iren", None) is not None:
1709-
try:
1710-
# pyvista<0.30.0
1711-
self.plotter._key_press_event_callbacks.clear()
1712-
except AttributeError:
1713-
# pyvista>=0.30.0
1714-
self.plotter.iren.clear_key_event_callbacks()
1709+
self.plotter.iren.clear_key_event_callbacks()
17151710

17161711
def _clear_widgets(self):
17171712
if not hasattr(self, 'widgets'):

mne/viz/backends/_pyvista.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -670,12 +670,7 @@ def _update_picking_callback(self,
670670
on_button_press,
671671
on_button_release,
672672
on_pick):
673-
try:
674-
# pyvista<0.30.0
675-
add_obs = self.plotter.iren.AddObserver
676-
except AttributeError:
677-
# pyvista>=0.30.0
678-
add_obs = self.plotter.iren.add_observer
673+
add_obs = self.plotter.iren.add_observer
679674
add_obs(vtk.vtkCommand.RenderEvent, on_mouse_move)
680675
add_obs(vtk.vtkCommand.LeftButtonPressEvent, on_button_press)
681676
add_obs(vtk.vtkCommand.EndInteractionEvent, on_button_release)

mne/viz/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def _nbclient():
5757
from jupyter_client import AsyncKernelManager
5858
from nbclient import NotebookClient
5959
from ipywidgets import Button # noqa
60-
import ipyvtk_simple # noqa
60+
import ipyvtklink # noqa
6161
except Exception as exc:
6262
return pytest.skip(f'Skipping Notebook test: {exc}')
6363
km = AsyncKernelManager(config=None)

mne/viz/tests/test_3d.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -728,12 +728,7 @@ def test_plot_sensors_connectivity(renderer):
728728

729729
fig = plot_sensors_connectivity(info=info, con=con, picks=picks)
730730
if renderer._get_3d_backend() == 'pyvista':
731-
try:
732-
# pyvista<0.30.0
733-
title = fig.plotter.scalar_bar.GetTitle()
734-
except AttributeError:
735-
# pyvista>=0.30.0
736-
title = list(fig.plotter.scalar_bars.values())[0].GetTitle()
731+
title = list(fig.plotter.scalar_bars.values())[0].GetTitle()
737732
else:
738733
assert renderer._get_3d_backend() == 'mayavi'
739734
# the last thing we add is the Tube, so we need to go

requirements.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ nilearn
2727
xlrd
2828
imageio>=2.6.1
2929
imageio-ffmpeg>=0.4.1
30-
pyvista>=0.24
31-
pyvistaqt>=0.2.0
30+
pyvista>=0.30
31+
https://api.github.com/repos/pyvista/pyvistaqt/zipball/8eb40405b31ef815527a2620bc395cb9c5548377
3232
tqdm
3333
mffpy>=0.5.7
3434
ipywidgets
35-
ipyvtk-simple
35+
ipyvtklink

server_environment.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ dependencies:
1212
- scipy
1313
- numpy
1414
- matplotlib-base
15-
- pyvista
15+
- pyvista>=0.30
1616
- nilearn
1717
- nibabel
1818
- nbformat <5.1 # XXX remove pinning once https://github.com/jupyter/nbformat/issues/206 has been fixed
@@ -23,5 +23,5 @@ dependencies:
2323
- jupyter
2424
- ipympl
2525
- ipywidgets
26-
- ipyvtk_simple
26+
- ipyvtklink
2727
- jupyter_client!=6.1.5

0 commit comments

Comments
 (0)