From 547e602662b21b7987e937b9f43745231c1e52c1 Mon Sep 17 00:00:00 2001 From: Fabio Pliger Date: Tue, 12 Apr 2022 15:28:08 -0500 Subject: [PATCH 1/3] fix examples landing page and some import issues --- pyscriptjs/examples/index.html | 38 +++++++++++++++++++++++----------- pyscriptjs/examples/repl.html | 2 +- pyscriptjs/examples/repl2.html | 2 +- 3 files changed, 28 insertions(+), 14 deletions(-) diff --git a/pyscriptjs/examples/index.html b/pyscriptjs/examples/index.html index a155030e..88e67767 100644 --- a/pyscriptjs/examples/index.html +++ b/pyscriptjs/examples/index.html @@ -7,9 +7,7 @@ PyScript demo - - - + @@ -17,16 +15,32 @@

PyScript demos


-

Simple script

-

A static demo of the <py-script> tag

+

Bokeh Interactive

+

Interactive demo using a Bokeh slider widget to dynamically change a value in the page

-

Simple script 2

+

Simple Static Bokeh Plot

+

Minimal Bokeh demo demonstrating how to create a simple bokeh plot from code

+ +

KMeans Demo in Panel

+

Interactive KMeans Chart using Panel

+ +

Simple Panel Demo

+

Simple demo showing Panel widgets interating with parts of the page

+ + +

REPL

+

A Python REPL (Read Eval Print Loop).

+ +

REPL2

+

A Python REPL (Read Eval Print Loop) with slightly better formatting.

+ +

Simple script

+

A static demo of the <py-script> tag

+ +

Simple script 2

A dynamic demo of the <py-script> tag

-

REPL

-

A Python REPL (Read Eval Print Loop).

- -

REPL2

-

A Python REPL (Read Eval Print Loop) with slightly better formatting.

+

TODO App

+

Demo showing how would a Simple TODO App would look like in PyScript tag

- + diff --git a/pyscriptjs/examples/repl.html b/pyscriptjs/examples/repl.html index 5944e034..806a73c0 100644 --- a/pyscriptjs/examples/repl.html +++ b/pyscriptjs/examples/repl.html @@ -7,7 +7,7 @@ Svelte app - + diff --git a/pyscriptjs/examples/repl2.html b/pyscriptjs/examples/repl2.html index 3b150e3b..145ee912 100644 --- a/pyscriptjs/examples/repl2.html +++ b/pyscriptjs/examples/repl2.html @@ -7,7 +7,7 @@ Svelte app - + From af107e84880f63cda29f9cd99b04b505b24023ae Mon Sep 17 00:00:00 2001 From: Fabio Pliger Date: Tue, 12 Apr 2022 15:30:58 -0500 Subject: [PATCH 2/3] add working to description of demos that take a little longer to load --- pyscriptjs/examples/index.html | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/pyscriptjs/examples/index.html b/pyscriptjs/examples/index.html index 88e67767..558c86fa 100644 --- a/pyscriptjs/examples/index.html +++ b/pyscriptjs/examples/index.html @@ -16,16 +16,25 @@

Bokeh Interactive

-

Interactive demo using a Bokeh slider widget to dynamically change a value in the page

+

Interactive demo using a Bokeh slider widget to dynamically change a value in the page + + WARNING: This examples takes a little longer to load. So be patient :) +

Simple Static Bokeh Plot

Minimal Bokeh demo demonstrating how to create a simple bokeh plot from code

KMeans Demo in Panel

-

Interactive KMeans Chart using Panel

+

Interactive KMeans Chart using Panel + + WARNING: This examples takes a little longer to load. So be patient :) +

Simple Panel Demo

-

Simple demo showing Panel widgets interating with parts of the page

+

Simple demo showing Panel widgets interating with parts of the page + + WARNING: This examples takes a little longer to load. So be patient :) +

REPL

From c29144d69c39c09e302d52ae73a99090dadf99fa Mon Sep 17 00:00:00 2001 From: Fabio Pliger Date: Tue, 12 Apr 2022 15:42:44 -0500 Subject: [PATCH 3/3] improve some of the demos font and removes repr for when objects are outputted to a div --- pyscriptjs/examples/index.html | 2 +- pyscriptjs/examples/simple_script.html | 2 +- pyscriptjs/examples/simple_script2.html | 8 ++++---- pyscriptjs/src/interpreter.ts | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pyscriptjs/examples/index.html b/pyscriptjs/examples/index.html index 558c86fa..986da26f 100644 --- a/pyscriptjs/examples/index.html +++ b/pyscriptjs/examples/index.html @@ -10,7 +10,7 @@ - +

PyScript demos


diff --git a/pyscriptjs/examples/simple_script.html b/pyscriptjs/examples/simple_script.html index 467e1837..f1822741 100644 --- a/pyscriptjs/examples/simple_script.html +++ b/pyscriptjs/examples/simple_script.html @@ -13,7 +13,7 @@ -
+
from datetime import datetime now = datetime.now() diff --git a/pyscriptjs/examples/simple_script2.html b/pyscriptjs/examples/simple_script2.html index d32860cb..431a5c7d 100644 --- a/pyscriptjs/examples/simple_script2.html +++ b/pyscriptjs/examples/simple_script2.html @@ -7,15 +7,15 @@ Svelte app - + -
-
-
+
start time:
+
+
from datetime import datetime now = datetime.now() diff --git a/pyscriptjs/src/interpreter.ts b/pyscriptjs/src/interpreter.ts index 9e4121aa..8578f851 100644 --- a/pyscriptjs/src/interpreter.ts +++ b/pyscriptjs/src/interpreter.ts @@ -35,7 +35,7 @@ class PyScript: console.log(f"DATA/IMAGE: {value}") document.getElementById(element_id).innerHTML = f'
' else: - document.getElementById(element_id).innerHTML = repr(value); + document.getElementById(element_id).innerHTML = value; console.log(f"ELSE: {append} ==> {element_id} --> {value}") @staticmethod