From a2c750da151583979aba8f1f25994fee4c8b476b Mon Sep 17 00:00:00 2001 From: YouGuessedMyName Date: Sat, 12 Oct 2024 17:30:36 +0200 Subject: [PATCH] Revert "Test" This reverts commit d2b6de8014baa4d56ee4a1d6a6a0354cb2f9969a. --- docs/getting_started/lol.html | 1 - docs/getting_started/study.ipynb | 12 ++---------- stormvogel/visjs.py | 32 ++++++++++++++------------------ 3 files changed, 16 insertions(+), 29 deletions(-) delete mode 100644 docs/getting_started/lol.html diff --git a/docs/getting_started/lol.html b/docs/getting_started/lol.html deleted file mode 100644 index 8fe9ede..0000000 --- a/docs/getting_started/lol.html +++ /dev/null @@ -1 +0,0 @@ -HELLO HTML diff --git a/docs/getting_started/study.ipynb b/docs/getting_started/study.ipynb index af7ca02..db48f12 100644 --- a/docs/getting_started/study.ipynb +++ b/docs/getting_started/study.ipynb @@ -154,14 +154,14 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 10, "id": "0df1511e-565d-45d0-93a8-adafbfaaaefa", "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "bc6d176108fb414bad62d341a984d211", + "model_id": "842f7d395ae045efa313f91bda29eef0", "version_major": 2, "version_minor": 0 }, @@ -176,14 +176,6 @@ "source": [ "vis = show(mdp, show_editor=False, layout=Layout(\"layouts/pinkgreen.json\"))" ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "caa359bf-4263-41f7-9222-f28d8325d218", - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { diff --git a/stormvogel/visjs.py b/stormvogel/visjs.py index 9bb794b..e71d56e 100644 --- a/stormvogel/visjs.py +++ b/stormvogel/visjs.py @@ -2,6 +2,7 @@ import IPython.display as ipd import ipywidgets as widgets +import html import stormvogel.displayable import stormvogel.html_templates import stormvogel.communication_server @@ -154,30 +155,25 @@ def generate_html(self) -> str: ).replace("__SIZES__", sizes) return html - def generate_iframe(self) -> ipd.IFrame: + def generate_iframe(self) -> str: """Generate an iframe for the network, using the html.""" - return ipd.IFrame( - src="lol.html", - width=self.width + self.EXTRA_PIXELS, - height=self.height + self.EXTRA_PIXELS, - ) - # return f""" - # """ + return f""" + """ def show(self) -> None: """Display the network on the output that was specified at initialization, otherwise simply display it.""" iframe = self.generate_iframe() with self.output: # Display the iframe within the Output. ipd.clear_output() - ipd.display(iframe) + ipd.display(ipd.HTML(iframe)) self.maybe_display_output() with self.debug_output: logging.info("Called Network.show") @@ -187,7 +183,7 @@ def reload(self) -> None: iframe = self.generate_iframe() with self.output: ipd.clear_output() - ipd.display(iframe) + ipd.display(ipd.HTML(iframe)) with self.debug_output: logging.info("Called Network.reload")