Skip to content

Commit 9ff1804

Browse files
committed
hopefully fix last test, add renderer test
1 parent a625f78 commit 9ff1804

File tree

7 files changed

+24
-21
lines changed

7 files changed

+24
-21
lines changed

doc/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ def __call__(self, gallery_conf, fname, when):
318318
except ImportError:
319319
MNEQtBrowser = None
320320
from mne.viz.backends.renderer import backend
321-
_Renderer = backend._Rnderer if backend is not None else None
321+
_Renderer = backend._Renderer if backend is not None else None
322322
reset_warnings(gallery_conf, fname)
323323
# in case users have interactive mode turned on in matplotlibrc,
324324
# turn it off here (otherwise the build can be very slow)

mne/viz/backends/_abstract.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,7 @@ def _add_widget(self, widget, row=None, col=None):
813813
pass
814814

815815

816-
class _AbstractApplication(ABC):
816+
class _AbstractAppWindow(ABC):
817817

818818
def __init__(self, size=None, fullscreen=False):
819819
pass

mne/viz/backends/_notebook.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
FloatSlider, BoundedFloatText, jsdlink)
1919
from ipyevents import Event
2020

21-
from ._abstract import (_AbstractApplication, _AbstractHBoxLayout,
21+
from ._abstract import (_AbstractAppWindow, _AbstractHBoxLayout,
2222
_AbstractVBoxLayout, _AbstractGridLayout,
2323
_AbstractWidget, _AbstractCanvas,
2424
_AbstractPopup, _AbstractLabel,
@@ -114,7 +114,7 @@ def _trigger_keypress(self, key):
114114
self._callback(key)
115115
# TO DO: actually simulate the keypress, see code below not yet working
116116
'''
117-
# trigger to a vbox which will be present because the _Application is
117+
# trigger to a vbox which will be present because the _AppWindow is
118118
# a vbox, this doesn't trigger specifically for the widget but this
119119
# is just for testing
120120
key_str = key.title() if len(key) > 1 else key
@@ -672,10 +672,10 @@ def _set_size(self, width=None, height=None):
672672
self.layout.height = height
673673

674674

675-
class _Application(_AbstractApplication, _Widget, VBox, metaclass=_BaseWidget):
675+
class _AppWindow(_AbstractAppWindow, _Widget, VBox, metaclass=_BaseWidget):
676676

677677
def __init__(self, size=None, fullscreen=False):
678-
_AbstractApplication.__init__(self)
678+
_AbstractAppWindow.__init__(self)
679679
_Widget.__init__(self)
680680
VBox.__init__(self, **_BASE_KWARGS)
681681

@@ -715,7 +715,7 @@ def _close(self):
715715
clear_output()
716716

717717

718-
class _Renderer(_PyVistaRenderer):
718+
class _3DRenderer(_PyVistaRenderer):
719719
_kind = 'notebook'
720720

721721
def __init__(self, *args, **kwargs):
@@ -1422,9 +1422,9 @@ def set_shortcut(self, shortcut):
14221422
pass
14231423

14241424

1425-
class _Rnderer(_PyVistaRenderer, _IpyDock, _IpyToolBar, _IpyMenuBar,
1426-
_IpyStatusBar, _IpyWindow, _IpyPlayback, _IpyDialog,
1427-
_IpyKeyPress):
1425+
class _Renderer(_PyVistaRenderer, _IpyDock, _IpyToolBar, _IpyMenuBar,
1426+
_IpyStatusBar, _IpyWindow, _IpyPlayback, _IpyDialog,
1427+
_IpyKeyPress):
14281428
_kind = 'notebook'
14291429

14301430
def __init__(self, *args, **kwargs):

mne/viz/backends/_qt.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
from ._pyvista import _PyVistaRenderer
3535
from ._pyvista import (_close_all, _close_3d_figure, _check_3d_figure, # noqa: F401,E501 analysis:ignore
3636
_set_3d_view, _set_3d_title, _take_3d_screenshot) # noqa: F401,E501 analysis:ignore
37-
from ._abstract import (_AbstractApplication, _AbstractHBoxLayout,
37+
from ._abstract import (_AbstractAppWindow, _AbstractHBoxLayout,
3838
_AbstractVBoxLayout, _AbstractGridLayout,
3939
_AbstractWidget, _AbstractCanvas,
4040
_AbstractPopup, _AbstractLabel, _AbstractButton,
@@ -634,12 +634,12 @@ def __init__(self, parent=None, title=None, size=None):
634634
self.setAttribute(Qt.WA_ShowWithoutActivating, True)
635635

636636

637-
class _Application(_AbstractApplication, _MNEMainWindow, _Widget,
638-
metaclass=_BaseWidget):
637+
class _AppWindow(_AbstractAppWindow, _MNEMainWindow, _Widget,
638+
metaclass=_BaseWidget):
639639

640640
def __init__(self, size=None, fullscreen=False):
641641
self._app = _init_mne_qtapp()
642-
_AbstractApplication.__init__(self)
642+
_AbstractAppWindow.__init__(self)
643643
_MNEMainWindow.__init__(self, size=size)
644644
_Widget.__init__(self)
645645

@@ -719,7 +719,7 @@ def _close(self):
719719
self.close()
720720

721721

722-
class _Renderer(_PyVistaRenderer):
722+
class _3DRenderer(_PyVistaRenderer):
723723
_kind = 'qt'
724724

725725
def __init__(self, *args, **kwargs):
@@ -1614,9 +1614,9 @@ def set_shortcut(self, shortcut):
16141614
self._action.setShortcut(shortcut)
16151615

16161616

1617-
class _Rnderer(_PyVistaRenderer, _QtDock, _QtToolBar, _QtMenuBar,
1618-
_QtStatusBar, _QtWindow, _QtPlayback, _QtDialog,
1619-
_QtKeyPress):
1617+
class _Renderer(_PyVistaRenderer, _QtDock, _QtToolBar, _QtMenuBar,
1618+
_QtStatusBar, _QtWindow, _QtPlayback, _QtDialog,
1619+
_QtKeyPress):
16201620
_kind = 'qt'
16211621

16221622
def __init__(self, *args, **kwargs):

mne/viz/backends/renderer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def _get_backend():
4040

4141
def _get_renderer(*args, **kwargs):
4242
_get_3d_backend()
43-
return backend._Rnderer(*args, **kwargs)
43+
return backend._Renderer(*args, **kwargs)
4444

4545

4646
def _check_3d_backend_name(backend_name):

mne/viz/backends/tests/test_abstract.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,11 @@ def _do_widget_tests(backend):
1515
def callback(x=None):
1616
widget_checks.add('click' if x is None else x)
1717

18-
window = backend._Application()
18+
window = backend._AppWindow()
1919
central_layout = backend._VBoxLayout(scroll=(500, 500))
20+
renderer = backend._3DRenderer(name='test', size=(200, 200))
21+
renderer.sphere([0, 0, 0], 'red', 1)
22+
central_layout._add_widget(renderer.plotter)
2023
canvas = backend._Canvas(5, 5, 96)
2124
canvas.ax.plot(range(10), range(10), label='plot')
2225
central_layout._add_widget(canvas)

mne/viz/backends/tests/test_renderer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def test_3d_functions(renderer):
4141
"""Test figure management functions."""
4242
fig = renderer.create_3d_figure((300, 300))
4343
assert isinstance(fig, Figure3D)
44-
wrap_renderer = renderer.backend._Rnderer(fig=fig)
44+
wrap_renderer = renderer.backend._Renderer(fig=fig)
4545
wrap_renderer.sphere(np.array([0., 0., 0.]), 'w', 1.)
4646
renderer.backend._check_3d_figure(fig)
4747
renderer.set_3d_view(figure=fig, azimuth=None, elevation=None,

0 commit comments

Comments
 (0)