From f560ec7a2a2de646edfc1fcea54ef077c7b536d0 Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Tue, 17 Jan 2023 14:19:43 -0500 Subject: [PATCH] WIP: DOC: Reload examples page if itkwidgets[lab] installed later If the imjoy jupyterlab extension is installed after JupyterLab has been loaded, the page needs to be reloaded to load up the added JavaScript. --- examples/Hello3DWorld.ipynb | 62 +++++++++++++++++++++++++------------ 1 file changed, 42 insertions(+), 20 deletions(-) diff --git a/examples/Hello3DWorld.ipynb b/examples/Hello3DWorld.ipynb index 4f2e2bc0..f63d7d4b 100644 --- a/examples/Hello3DWorld.ipynb +++ b/examples/Hello3DWorld.ipynb @@ -26,7 +26,37 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 2, + "id": "31627b8b-d753-4438-b46d-4a1ba164cacc", + "metadata": {}, + "outputs": [ + { + "data": { + "application/javascript": [ + "// If itkwidgets was installed after Jupyter was started, we need to reload the page.\n", + "if (typeof window.loadImJoyRPC === 'undefined') {\n", + " location.reload()\n", + "}\n" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%%javascript\n", + "// If itkwidgets was installed after Jupyter was started, we need to reload the page.\n", + "if (typeof window.loadImJoyRPC === 'undefined') {\n", + " location.reload()\n", + "}" + ] + }, + { + "cell_type": "code", + "execution_count": 3, "id": "c3c5eb6e", "metadata": {}, "outputs": [], @@ -42,7 +72,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 4, "id": "1bc45207", "metadata": {}, "outputs": [], @@ -52,7 +82,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 5, "id": "26582452", "metadata": {}, "outputs": [ @@ -60,11 +90,11 @@ "data": { "text/html": [ "\n", - " \n", + " \n", " \n", @@ -80,7 +110,7 @@ { "data": { "application/javascript": [ - "window.connectPlugin && window.connectPlugin(\"22a08c0c-2bb4-4cc9-977c-735cbff2c59d\")" + "window.connectPlugin && window.connectPlugin(\"0993fcce-faf5-4084-a7bc-92338539b75c\")" ], "text/plain": [ "" @@ -92,7 +122,7 @@ { "data": { "text/html": [ - "
" + "
" ], "text/plain": [ "" @@ -104,10 +134,10 @@ { "data": { "text/plain": [ - "" + "" ] }, - "execution_count": 3, + "execution_count": 5, "metadata": {}, "output_type": "execute_result" } @@ -116,14 +146,6 @@ "viewer = view(stent, rotate=True)\n", "viewer" ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "4e0450d4", - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { @@ -142,7 +164,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.5" + "version": "3.10.8" } }, "nbformat": 4,