From d2b6de8014baa4d56ee4a1d6a6a0354cb2f9969a Mon Sep 17 00:00:00 2001 From: YouGuessedMyName Date: Sat, 12 Oct 2024 17:27:14 +0200 Subject: [PATCH] Test --- docs/getting_started/lol.html | 1 + docs/getting_started/study.ipynb | 12 ++++++++++-- stormvogel/visjs.py | 32 ++++++++++++++++++-------------- 3 files changed, 29 insertions(+), 16 deletions(-) create mode 100644 docs/getting_started/lol.html diff --git a/docs/getting_started/lol.html b/docs/getting_started/lol.html new file mode 100644 index 0000000..8fe9ede --- /dev/null +++ b/docs/getting_started/lol.html @@ -0,0 +1 @@ +HELLO HTML diff --git a/docs/getting_started/study.ipynb b/docs/getting_started/study.ipynb index db48f12..af7ca02 100644 --- a/docs/getting_started/study.ipynb +++ b/docs/getting_started/study.ipynb @@ -154,14 +154,14 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 8, "id": "0df1511e-565d-45d0-93a8-adafbfaaaefa", "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "842f7d395ae045efa313f91bda29eef0", + "model_id": "bc6d176108fb414bad62d341a984d211", "version_major": 2, "version_minor": 0 }, @@ -176,6 +176,14 @@ "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 e71d56e..9bb794b 100644 --- a/stormvogel/visjs.py +++ b/stormvogel/visjs.py @@ -2,7 +2,6 @@ import IPython.display as ipd import ipywidgets as widgets -import html import stormvogel.displayable import stormvogel.html_templates import stormvogel.communication_server @@ -155,25 +154,30 @@ def generate_html(self) -> str: ).replace("__SIZES__", sizes) return html - def generate_iframe(self) -> str: + def generate_iframe(self) -> ipd.IFrame: """Generate an iframe for the network, using the html.""" - return f""" - """ + return ipd.IFrame( + src="lol.html", + width=self.width + self.EXTRA_PIXELS, + height=self.height + self.EXTRA_PIXELS, + ) + # 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(ipd.HTML(iframe)) + ipd.display(iframe) self.maybe_display_output() with self.debug_output: logging.info("Called Network.show") @@ -183,7 +187,7 @@ def reload(self) -> None: iframe = self.generate_iframe() with self.output: ipd.clear_output() - ipd.display(ipd.HTML(iframe)) + ipd.display(iframe) with self.debug_output: logging.info("Called Network.reload")