Skip to content

Commit 21d7ea0

Browse files
committed
cruft
1 parent 3762d77 commit 21d7ea0

File tree

1 file changed

+3
-18
lines changed

1 file changed

+3
-18
lines changed

mne/viz/backends/_notebook.py

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -111,24 +111,9 @@ def _add_keypress(self, callback):
111111
self._callback = callback
112112

113113
def _trigger_keypress(self, key):
114+
# note: this doesn't actually simulate a keypress, it just calls the
115+
# callback function directly because this is not yet possible
114116
self._callback(key)
115-
# TO DO: actually simulate the keypress, see code below not yet working
116-
'''
117-
# trigger to a vbox which will be present because the _AppWindow is
118-
# a vbox, this doesn't trigger specifically for the widget but this
119-
# is just for testing
120-
# note: ipywidgets.HTML does not execute javascript but
121-
# IPython.display.HTML does
122-
key_str = key.title() if len(key) > 1 else key
123-
display(IPython.display.HTML("""
124-
<script>
125-
let element = document.getElementsByClassName("widget-vbox")[0];
126-
element.dispatchEvent(
127-
new KeyboardEvent( 'keydown' , {'key':'%s'} ));
128-
element.dispatchEvent(
129-
new KeyboardEvent( 'keyup' , {'key':'%s'} ));
130-
</script>""" % (key_str, key_str)))
131-
'''
132117

133118
def _set_focus(self):
134119
if hasattr(self, 'focus'): # added in ipywidgets 8.0
@@ -591,7 +576,7 @@ def _add_widget(self, widget):
591576
# if pyvista plotter, needs to be shown
592577
if isinstance(widget, Plotter):
593578
widget = widget.show(
594-
jupyter_backend="ipyvtklink", return_viewer=True)
579+
jupyter_backend='ipyvtklink', return_viewer=True)
595580
widget.layout.width = None # unlock the fixed layout
596581
if hasattr(widget, 'layout'):
597582
widget.layout.margin = "2px 0px 2px 0px"

0 commit comments

Comments
 (0)