Skip to content

Commit

Permalink
Revert "Test"
Browse files Browse the repository at this point in the history
This reverts commit d2b6de8.
  • Loading branch information
YouGuessedMyName committed Oct 12, 2024
1 parent d2b6de8 commit a2c750d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 29 deletions.
1 change: 0 additions & 1 deletion docs/getting_started/lol.html

This file was deleted.

12 changes: 2 additions & 10 deletions docs/getting_started/study.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
Expand All @@ -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": {
Expand Down
32 changes: 14 additions & 18 deletions stormvogel/visjs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"""
# <iframe
# id="{self.name}"
# width="{self.width + self.EXTRA_PIXELS}"
# height="{self.height + self.EXTRA_PIXELS}"
# frameborder="0"
# srcdoc="{html.escape(self.generate_html())}"
# border:none !important;
# allowfullscreen webkitallowfullscreen mozallowfullscreen
# ></iframe>"""
return f"""
<iframe
id="{self.name}"
width="{self.width + self.EXTRA_PIXELS}"
height="{self.height + self.EXTRA_PIXELS}"
frameborder="0"
srcdoc="{html.escape(self.generate_html())}"
border:none !important;
allowfullscreen webkitallowfullscreen mozallowfullscreen
></iframe>"""

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")
Expand All @@ -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")

Expand Down

0 comments on commit a2c750d

Please sign in to comment.