Commit 3cd63c37 authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

Merge branch 'rf/notebook' into 'master'

Rf/notebook

See merge request fsl/fsleyes/fsleyes!227
parents dc78031d 10c4c3fe
......@@ -66,6 +66,7 @@ Fixed
by default, instead of the ``mean`` underlay.
* Fixed a bug in image texture preparation for complex data types, when
running in a limited GL environment (e.g. VNC).
* Compatibility fixes for newer versions of Jupyter `notebook`.
0.34.2 (Tuesday 14th July 2020)
......
......@@ -6,8 +6,6 @@
#
from tornado import gen
from notebook.services.kernels.kernelmanager import MappingKernelManager
......@@ -25,7 +23,7 @@ class FSLeyesNotebookKernelManager(MappingKernelManager):
"""
def __init__(self, *args, **kwargs):
super(FSLeyesNotebookKernelManager, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)
def __patch_connection(self, kernel):
......@@ -40,16 +38,14 @@ class FSLeyesNotebookKernelManager(MappingKernelManager):
kernel.load_connection_file(self.connfile)
@gen.coroutine
def start_kernel(self, **kwargs):
async def start_kernel(self, **kwargs):
"""Overrides ``MappingKernelManager.start_kernel``. Connects
all new kernels to the IPython kernel specified by ``connfile``.
"""
kid = super(FSLeyesNotebookKernelManager, self)\
.start_kernel(**kwargs).result()
kid = await super().start_kernel(**kwargs)
kernel = self._kernels[kid]
self.__patch_connection(kernel)
raise gen.Return(kid)
return kid
def restart_kernel(self, *args, **kwargs):
......
......@@ -380,8 +380,12 @@ class BackgroundIPythonKernel(object):
return self.__error
def __screenshot(self, view):
"""Insert a screenshot of the given view into the notebook. """
def __screenshot(self, view=None):
"""Insert a screenshot of the given view panel into the notebook.
If ``view`` is not specified, the first view is assumed.
"""
if view is None:
view = self.__frame.viewPanels[0]
with tempdir.tempdir():
screenshot.screenshot(view, 'screenshot.png')
return display.Image('screenshot.png')
......
......@@ -2,5 +2,5 @@ pyzmq>=17.0
tornado>=5.0
ipykernel>=4.8
ipython>=5
jupyter_client>=5.2
notebook>=5.5
jupyter_client>=5.3.1
notebook>=6.0.0
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment