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 README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ For full functionality, some functions require:
- Picard >= 0.3
- CuPy >= 4.0 (for NVIDIA CUDA acceleration)
- DIPY >= 0.10.1
- PyVista >= 0.23.1
- PyVista >= 0.24

Contributing to MNE-Python
^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
34 changes: 2 additions & 32 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,38 +369,8 @@
except Exception:
pass
else:
# XXX hack, adapted from PyVista to work around
# https://github.com/mne-tools/mne-python/issues/7228
# https://github.com/pyvista/pyvista/pull/548
import shutil

class Scraper(object): # noqa:D101

def __repr__(self): # noqa:D101
return 'PyVista Scraper'

def __call__(self, block, block_vars, gallery_conf): # noqa:D101
from sphinx_gallery.scrapers import figure_rst
image_names = list()
image_path_iterator = block_vars["image_path_iterator"]
figures = pyvista.plotting._ALL_PLOTTERS
seen_plotters = list()
for address, plotter in figures.items():
if plotter in seen_plotters:
continue
seen_plotters += [plotter]
fname = next(image_path_iterator)
if hasattr(plotter, '_gif_filename'):
# move gif to fname
shutil.move(plotter._gif_filename, fname)
else:
plotter.screenshot(fname)
image_names.append(fname)
pyvista.close_all() # close and clear all plotters
return figure_rst(image_names, gallery_conf["src_dir"])
scrapers += (Scraper(),) # eventually just ('pyvista',)
if any(x in scrapers for x in ('pyvista', 'mayavi')) or \
any('PyVista' in repr(s) for s in scrapers): # just for our hack
scrapers += ('pyvista',)
if any(x in scrapers for x in ('pyvista', 'mayavi')):
from traits.api import push_exception_handler
push_exception_handler(reraise_exceptions=True)
report_scraper = mne.report._ReportScraper()
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ dependencies:
- pip:
- mne
- https://api.github.com/repos/numpy/numpydoc/zipball/master
- pyvista>=0.23.1
- pyvista>=0.24
- mayavi
- PySurfer[save_movie]
- dipy --only-binary dipy
Expand Down
18 changes: 10 additions & 8 deletions mne/viz/_brain/_timeviewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,14 @@
class MplCanvas(object):
"""Ultimately, this is a QWidget (as well as a FigureCanvasAgg, etc.)."""

def __init__(self, timeviewer, parent, width, height, dpi):
def __init__(self, timeviewer, width, height, dpi):
from PyQt5 import QtWidgets
from matplotlib.figure import Figure
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg
if timeviewer.separate_canvas:
parent = None
else:
parent = timeviewer.window
self.fig = Figure(figsize=(width, height), dpi=dpi)
self.canvas = FigureCanvasQTAgg(self.fig)
self.axes = self.fig.add_subplot(111)
Expand Down Expand Up @@ -316,7 +320,9 @@ def __init__(self, brain, show_traces=False):
self.brain.time_viewer = self
self.plotter = brain._renderer.plotter
self.main_menu = self.plotter.main_menu
self.interactor = self.plotter
self.window = self.plotter.app_window
self.status_bar = self.window.statusBar()
self.interactor = self.plotter.interactor
self.interactor.keyPressEvent = self.keyPressEvent

# Derived parameters:
Expand Down Expand Up @@ -402,7 +408,7 @@ def play(self):
self.time_call(idx, update_widget=True)
if time_point == max_time:
self.playback = False
self.plotter.update() # critical for smooth animation
self.plotter.update() # critical for smooth animation

def set_slider_style(self, slider, show_label=True):
if slider is not None:
Expand Down Expand Up @@ -615,11 +621,7 @@ def configure_point_picking(self):
dpi = win.windowHandle().screen().logicalDotsPerInch()
w, h = win.geometry().width() / dpi, win.geometry().height() / dpi
h /= 3 # one third of the window
if self.separate_canvas:
parent = None
else:
parent = win
self.mpl_canvas = MplCanvas(self, parent, w, h, dpi)
self.mpl_canvas = MplCanvas(self, w, h, dpi)
xlim = [np.min(self.brain._data['time']),
np.max(self.brain._data['time'])]
self.mpl_canvas.axes.set(xlim=xlim)
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ xlrd
pydocstyle
flake8
https://api.github.com/repos/mcmtroffaes/sphinxcontrib-bibtex/zipball/29694f215b39d64a31b845aafd9ff2ae9329494f
pyvista>=0.23.1
pyvista>=0.24