From aff08668cb424635bf1798c250da4b4a927ed986 Mon Sep 17 00:00:00 2001 From: Aayush Badoni Date: Mon, 3 Jun 2024 20:53:08 +0530 Subject: [PATCH 1/4] Combined POC --- _sources/index.rst | 3 ++- _sources/pycomponent.rst | 6 ++++++ pyscript.html | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 _sources/pycomponent.rst create mode 100644 pyscript.html diff --git a/_sources/index.rst b/_sources/index.rst index f78eb8314d..c43ecc10c0 100644 --- a/_sources/index.rst +++ b/_sources/index.rst @@ -31,4 +31,5 @@ Contenidos: :maxdepth: 1 index_es - index_en \ No newline at end of file + index_en + pycomponent \ No newline at end of file diff --git a/_sources/pycomponent.rst b/_sources/pycomponent.rst new file mode 100644 index 0000000000..256e738f36 --- /dev/null +++ b/_sources/pycomponent.rst @@ -0,0 +1,6 @@ +============================== +Interactive PyScript Component +============================== + +A combined PoC of the PyScript Component with a an ehanced UI. + diff --git a/pyscript.html b/pyscript.html new file mode 100644 index 0000000000..c1a46ad071 --- /dev/null +++ b/pyscript.html @@ -0,0 +1,33 @@ +
+
+ +
+
From 76690b490f474c0c5295721ea6e54c414d959a0f Mon Sep 17 00:00:00 2001 From: Aayush Badoni Date: Mon, 3 Jun 2024 21:01:56 +0530 Subject: [PATCH 2/4] Combined POC: path changes --- _sources/pycomponent.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/_sources/pycomponent.rst b/_sources/pycomponent.rst index 256e738f36..cd58719145 100644 --- a/_sources/pycomponent.rst +++ b/_sources/pycomponent.rst @@ -2,5 +2,7 @@ Interactive PyScript Component ============================== -A combined PoC of the PyScript Component with a an ehanced UI. +A combined PoC of the PyScript Component with a an ehanced UI. +.. raw:: html + :file: ../pyscript.html \ No newline at end of file From 75a8f88132fe6002862aaf7aa83ba38416912a74 Mon Sep 17 00:00:00 2001 From: Aayush Badoni Date: Mon, 10 Jun 2024 21:50:05 +0530 Subject: [PATCH 3/4] added: code area, output area + refresh feature --- pyscript.html | 87 +++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 67 insertions(+), 20 deletions(-) diff --git a/pyscript.html b/pyscript.html index c1a46ad071..c6aca41c4e 100644 --- a/pyscript.html +++ b/pyscript.html @@ -1,33 +1,80 @@ -
-
- -
-
+ style="border: 1px solid #ccc; background-color: #fff" + > + + + + + + + From 5656e22f849629d5faa12387be7dade717271f85 Mon Sep 17 00:00:00 2001 From: Aayush Badoni Date: Wed, 21 Aug 2024 21:35:30 +0530 Subject: [PATCH 4/4] adds ltk + pyscript editor --- _sources/index_en.rst | 1 + _sources/index_es.rst | 1 + _sources/lectures/TWP67/TWP67_1_en.rst | 55 ++++++++++++++++ _sources/lectures/TWP67/toctree.rst | 18 ++++++ _sources/lectures/TWP67/toctree_en.rst | 18 ++++++ _sources/lectures/_static/index1.html | 90 ++++++++++++++++++++++++++ _sources/lectures/_static/mini-coi.js | 28 ++++++++ _sources/pycomponent.rst | 8 --- 8 files changed, 211 insertions(+), 8 deletions(-) create mode 100644 _sources/lectures/TWP67/TWP67_1_en.rst create mode 100644 _sources/lectures/TWP67/toctree.rst create mode 100644 _sources/lectures/TWP67/toctree_en.rst create mode 100644 _sources/lectures/_static/index1.html create mode 100644 _sources/lectures/_static/mini-coi.js delete mode 100644 _sources/pycomponent.rst diff --git a/_sources/index_en.rst b/_sources/index_en.rst index 07582b56c2..c5a5cb9814 100644 --- a/_sources/index_en.rst +++ b/_sources/index_en.rst @@ -34,6 +34,7 @@ Contents: lectures/TWP58/toctree_en lectures/TWP60/toctree_en lectures/TWP65/toctree_en + lectures/TWP67/toctree_en quiz/Quiz1_en.rst quiz/Quiz2_en.rst quiz/Quiz3_en.rst diff --git a/_sources/index_es.rst b/_sources/index_es.rst index ecf1551c24..1cb3b96bca 100644 --- a/_sources/index_es.rst +++ b/_sources/index_es.rst @@ -34,6 +34,7 @@ Contenidos: lectures/TWP58/toctree lectures/TWP60/toctree lectures/TWP65/toctree + lectures/TWP67/toctree quiz/Quiz1.rst quiz/Quiz2.rst quiz/Quiz3.rst diff --git a/_sources/lectures/TWP67/TWP67_1_en.rst b/_sources/lectures/TWP67/TWP67_1_en.rst new file mode 100644 index 0000000000..ff0a1c241a --- /dev/null +++ b/_sources/lectures/TWP67/TWP67_1_en.rst @@ -0,0 +1,55 @@ +=== +PoC +=== + +Try These +--------- + + +.. code-block:: python + + import numpy as np + import matplotlib.pyplot as plt + from pyscript import display + + # Define the domain + N = 55 + X = np.linspace(-5, 5, N) + Y = np.sin(X) + + # Plotting the values + plt.plot(X, Y, 'b-') + plt.grid(True) + + # Display a message + print("The plot is displayed below:") + + # Display the plot on the webpage + display(plt, target="output", append=False) + +.. code-block:: python + + import ltk + + # Clear the output div before adding new content + ltk.find("#output").empty() + + # Create and append new elements to the output div + ( + ltk.VBox( + ltk.HBox( + ltk.Text("Hello"), + ltk.Button( + "World", + lambda event: + ltk.find(".ltk-button, a") + .css("color", "red") + ) + .css("color", "blue") + ) + ) + .appendTo(ltk.find("#output")) # Append to the output div + ) + +.. raw:: html + :file: ../_static/index1.html diff --git a/_sources/lectures/TWP67/toctree.rst b/_sources/lectures/TWP67/toctree.rst new file mode 100644 index 0000000000..5dddc02da3 --- /dev/null +++ b/_sources/lectures/TWP67/toctree.rst @@ -0,0 +1,18 @@ +========== +Editor PoC +========== + + +.. image:: ../img/TWP10_001.jpeg + :height: 14.925cm + :width: 9.258cm + :align: center + :alt: + + +.. toctree:: + :caption: Contenido + :maxdepth: 1 + :numbered: + + TWP67_1_en.rst \ No newline at end of file diff --git a/_sources/lectures/TWP67/toctree_en.rst b/_sources/lectures/TWP67/toctree_en.rst new file mode 100644 index 0000000000..5dddc02da3 --- /dev/null +++ b/_sources/lectures/TWP67/toctree_en.rst @@ -0,0 +1,18 @@ +========== +Editor PoC +========== + + +.. image:: ../img/TWP10_001.jpeg + :height: 14.925cm + :width: 9.258cm + :align: center + :alt: + + +.. toctree:: + :caption: Contenido + :maxdepth: 1 + :numbered: + + TWP67_1_en.rst \ No newline at end of file diff --git a/_sources/lectures/_static/index1.html b/_sources/lectures/_static/index1.html new file mode 100644 index 0000000000..7597eec547 --- /dev/null +++ b/_sources/lectures/_static/index1.html @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + + + + +
+ + + + +
+
+ + + + diff --git a/_sources/lectures/_static/mini-coi.js b/_sources/lectures/_static/mini-coi.js new file mode 100644 index 0000000000..5ee52f2973 --- /dev/null +++ b/_sources/lectures/_static/mini-coi.js @@ -0,0 +1,28 @@ +/*! coi-serviceworker v0.1.7 - Guido Zuidhof and contributors, licensed under MIT */ +/*! mini-coi - Andrea Giammarchi and contributors, licensed under MIT */ +(({ document: d, navigator: { serviceWorker: s } }) => { + if (d) { + const { currentScript: c } = d; + s.register(c.src, { scope: c.getAttribute('scope') || '.' }).then(r => { + r.addEventListener('updatefound', () => location.reload()); + if (r.active && !s.controller) location.reload(); + }); + } + else { + addEventListener('install', () => skipWaiting()); + addEventListener('activate', e => e.waitUntil(clients.claim())); + addEventListener('fetch', e => { + const { request: r } = e; + if (r.cache === 'only-if-cached' && r.mode !== 'same-origin') return; + e.respondWith(fetch(r).then(r => { + const { body, status, statusText } = r; + if (!status || status > 399) return r; + const h = new Headers(r.headers); + h.set('Cross-Origin-Opener-Policy', 'same-origin'); + h.set('Cross-Origin-Embedder-Policy', 'require-corp'); + h.set('Cross-Origin-Resource-Policy', 'cross-origin'); + return new Response(body, { status, statusText, headers: h }); + })); + }); + } +})(self); \ No newline at end of file diff --git a/_sources/pycomponent.rst b/_sources/pycomponent.rst deleted file mode 100644 index cd58719145..0000000000 --- a/_sources/pycomponent.rst +++ /dev/null @@ -1,8 +0,0 @@ -============================== -Interactive PyScript Component -============================== - -A combined PoC of the PyScript Component with a an ehanced UI. - -.. raw:: html - :file: ../pyscript.html \ No newline at end of file