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
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ dependencies:
- spyder-kernels>=1.10.0
- imageio-ffmpeg>=0.4.1
- vtk>=9.0.1
- pyvista>=0.24,<=0.29
- pyvista>=0.24
- pyvistaqt>=0.2.0
- mayavi
- PySurfer
Expand Down
2 changes: 2 additions & 0 deletions mne/viz/_brain/_brain.py
Original file line number Diff line number Diff line change
Expand Up @@ -1692,8 +1692,10 @@ def _clear_callbacks(self):
# Remove the default key binding
if getattr(self, "iren", None) is not None:
try:
# pyvista<0.3.0
self.plotter._key_press_event_callbacks.clear()
except AttributeError:
# pyvista>=0.3.0
self.plotter.iren.clear_key_event_callbacks()

def _clear_widgets(self):
Expand Down
4 changes: 3 additions & 1 deletion mne/viz/backends/_notebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,11 +342,13 @@ def show(self):
display(self._tool_bar)
# viewer
try:
# pyvista<0.30.0
viewer = self.plotter.show(
use_ipyvtk=True, return_viewer=True)
except RuntimeError:
# pyvista>=0.30.0
viewer = self.plotter.show(
backend="ipyvtk_simple", return_viewer=True)
jupyter_backend="ipyvtk_simple", return_viewer=True)
viewer.layout.width = None # unlock the fixed layout
# main widget
if self._dock is None:
Expand Down
21 changes: 9 additions & 12 deletions mne/viz/backends/_pyvista.py
Original file line number Diff line number Diff line change
Expand Up @@ -668,18 +668,15 @@ def _update_picking_callback(self,
on_button_press,
on_button_release,
on_pick):
self.plotter.iren.AddObserver(
vtk.vtkCommand.RenderEvent,
on_mouse_move
)
self.plotter.iren.AddObserver(
vtk.vtkCommand.LeftButtonPressEvent,
on_button_press
)
self.plotter.iren.AddObserver(
vtk.vtkCommand.EndInteractionEvent,
on_button_release
)
try:
# pyvista<0.30.0
add_obs = self.plotter.iren.AddObserver
except AttributeError:
# pyvista>=0.30.0
add_obs = self.plotter.iren.add_observer
add_obs(vtk.vtkCommand.RenderEvent, on_mouse_move)
add_obs(vtk.vtkCommand.LeftButtonPressEvent, on_button_press)
add_obs(vtk.vtkCommand.EndInteractionEvent, on_button_release)
self.plotter.picker = vtk.vtkCellPicker()
self.plotter.picker.AddObserver(
vtk.vtkCommand.EndPickEvent,
Expand Down
7 changes: 6 additions & 1 deletion mne/viz/tests/test_3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,12 @@ def test_plot_sensors_connectivity(renderer):

fig = plot_sensors_connectivity(info=info, con=con, picks=picks)
if renderer._get_3d_backend() == 'pyvista':
title = fig.plotter.scalar_bar.GetTitle()
try:
# pyvista<0.30.0
title = fig.plotter.scalar_bar.GetTitle()
except AttributeError:
# pyvista>=0.30.0
title = list(fig.plotter.scalar_bars.values())[0].GetTitle()
else:
assert renderer._get_3d_backend() == 'mayavi'
# the last thing we add is the Tube, so we need to go
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ nilearn
xlrd
imageio>=2.6.1
imageio-ffmpeg>=0.4.1
pyvista>=0.24,<=0.29
pyvista>=0.24
pyvistaqt>=0.2.0
tqdm
mffpy>=0.5.7
Expand Down
2 changes: 1 addition & 1 deletion tools/azure_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ elif [ "${TEST_MODE}" == "pip-pre" ]; then
python -m pip install --progress-bar off --upgrade --pre --only-binary ":all:" -f "https://7933911d6844c6c53a7d-47bd50c35cd79bd838daf386af554a83.ssl.cf2.rackcdn.com" h5py Pillow
python -m pip install --progress-bar off --upgrade --pre --only-binary ":all" vtk
python -m pip install --progress-bar off --upgrade --only-binary ":all" matplotlib
python -m pip install --progress-bar off https://github.com/pyvista/pyvista/zipball/cb59a9ddfd97f5724f733bc226b41fb9ad4c9c5f
python -m pip install --progress-bar off https://github.com/pyvista/pyvista/zipball/master
python -m pip install --progress-bar off https://github.com/pyvista/pyvistaqt/zipball/master
python -m pip install --progress-bar off --upgrade --only-binary="numba,llvmlite" -r requirements.txt
else
Expand Down
3 changes: 2 additions & 1 deletion tools/circleci_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ if [[ "$CIRCLE_JOB" == "interactive_test" ]]; then
python -m pip install --progress-bar off --upgrade --pre --only-binary ":all:" numba llvmlite
wget -q https://osf.io/kej3v/download -O vtk-9.0.20201117-cp39-cp39-linux_x86_64.whl
python -m pip install --progress-bar off vtk-9.0.20201117-cp39-cp39-linux_x86_64.whl
python -m pip install --progress-bar off https://github.com/pyvista/pyvista/zipball/master
python -m pip install --progress-bar off https://github.com/pyvista/pyvistaqt/zipball/master
python -m pip install --progress-bar off --upgrade -r requirements_testing.txt
python -m pip install nitime
Expand All @@ -33,7 +34,7 @@ else # standard doc build
echo "Installing doc build dependencies"
python -m pip uninstall -y pydata-sphinx-theme
python -m pip install --upgrade --progress-bar off -r requirements.txt -r requirements_testing.txt -r requirements_doc.txt
python -m pip install --progress-bar off https://github.com/pyvista/pyvista/zipball/cb59a9ddfd97f5724f733bc226b41fb9ad4c9c5f
python -m pip install --progress-bar off https://github.com/pyvista/pyvista/zipball/master
python -m pip install --progress-bar off https://github.com/pyvista/pyvistaqt/zipball/master
python -m pip uninstall -yq pysurfer mayavi
python -m pip install -e .
Expand Down
2 changes: 1 addition & 1 deletion tools/github_actions_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ else # pip --pre 3.9 (missing dipy in pre)
# built using vtk master branch on an Ubuntu 18.04.5 VM and uploaded to OSF:
wget -q https://osf.io/kej3v/download -O vtk-9.0.20201117-cp39-cp39-linux_x86_64.whl
pip install --progress-bar off vtk-9.0.20201117-cp39-cp39-linux_x86_64.whl
pip install --progress-bar off https://github.com/pyvista/pyvista/zipball/cb59a9ddfd97f5724f733bc226b41fb9ad4c9c5f
pip install --progress-bar off https://github.com/pyvista/pyvista/zipball/master
pip install --progress-bar off https://github.com/pyvista/pyvistaqt/zipball/master
fi
pip install --progress-bar off --upgrade -r requirements_testing.txt
Expand Down