Ver código fonte

updated user guide render notebook feature

Gilbert Brault 5 anos atrás
pai
commit
0ee0a7b8cd

+ 2 - 0
jupysketch-doc/docs/gallerydoc.md

@@ -1,3 +1,5 @@
+[The notebook](resources/Gallery.ipynb)
+
 | Dry Friction                           | Car                         | Pendulum                         |
 | Dry Friction                           | Car                         | Pendulum                         |
 |:--------------------------------------:|:---------------------------:|:--------------------------------:|
 |:--------------------------------------:|:---------------------------:|:--------------------------------:|
 | ![](Gallery/dryfriction.svg)           |  ![](Gallery/car.svg)       | ![](Gallery/pendulum.svg)        |
 | ![](Gallery/dryfriction.svg)           |  ![](Gallery/car.svg)       | ![](Gallery/pendulum.svg)        |

Diferenças do arquivo suprimidas por serem muito extensas
+ 0 - 1172
jupysketch-doc/docs/resources/DryFriction copy.ipynb


+ 153 - 0
jupysketch-doc/docs/resources/Gallery.ipynb

@@ -0,0 +1,153 @@
+{
+ "cells": [
+  {
+   "cell_type": "markdown",
+   "metadata": {},
+   "source": [
+    "# Gallery"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 1,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "%matplotlib widget"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 2,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "from ipywidgets import HBox, VBox, Output, Label"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 3,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "url = \"https://raw.githubusercontent.com/gbrault/jupytersketches/master/\""
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 4,
+   "metadata": {},
+   "outputs": [
+    {
+     "output_type": "display_data",
+     "data": {
+      "text/plain": "Output()",
+      "application/vnd.jupyter.widget-view+json": {
+       "version_major": 2,
+       "version_minor": 0,
+       "model_id": "52ea7cdf6d824834862f556af8859788"
+      }
+     },
+     "metadata": {}
+    }
+   ],
+   "source": [
+    "gallery = Output()\n",
+    "gallery"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 5,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "from pysketcher import *"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 6,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "import time"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 7,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "from IPython.display import HTML, SVG, display, clear_output"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 8,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "files = [(\"dryfriction\",\"friction\"),(\"pendulum\",\"pendulum\"),\n",
+    "         (\"car\",\"car\"),(\"springmass\",\"springmass\"),\n",
+    "         (\"springdashpotmass\",\"springdashpotmass\"),(\"jet_pump\",\"jet_pump\")]"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 9,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "i = 0\n",
+    "horiz = []\n",
+    "vert = []\n",
+    "outputs = [Output() for file in files]\n",
+    "for output in outputs:\n",
+    "    if i == 3:\n",
+    "        vert.append(HBox(horiz))\n",
+    "        horiz = [output]\n",
+    "        i = 0\n",
+    "    else:\n",
+    "        i += 1\n",
+    "        horiz.append(output)\n",
+    "if i >= 0 and i < 3:\n",
+    "    vert.append(HBox(horiz))\n",
+    "with gallery:\n",
+    "    display(VBox(vert))\n",
+    "\n",
+    "i = 0\n",
+    "for file in files:\n",
+    "    sketch = Sketch({})\n",
+    "    sketch.url2Sketch(url + file[0] +\".yml\")\n",
+    "    drawing_tool.erase()\n",
+    "    sketch.container[file[1]].draw()\n",
+    "    link = f\"<a target=\\\"_blank\\\" href=\\\"{url + file[0] +'.yml'}\\\"><h3>{file[0]}</h3></a>\"\n",
+    "    with outputs[i]:\n",
+    "        clear_output(wait=True)\n",
+    "        display(HTML(link),\n",
+    "                SVG(Sketch.matplotlib2SVG()))\n",
+    "    i += 1\n",
+    "    time.sleep(0.1)"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "metadata": {},
+   "outputs": [],
+   "source": []
+  }
+ ],
+ "metadata": {
+  "kernelspec": {
+   "display_name": "Python 3",
+   "language": "python",
+   "name": "python3"
+  }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 4
+}

+ 3 - 1
jupysketch-doc/mkdocs.yml

@@ -15,4 +15,6 @@ markdown_extensions:
 extra_javascript:
 extra_javascript:
     - 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML'
     - 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML'
 plugins:
 plugins:
-    - search  
+    - search
+    - mkdocs-jupyter:
+        execute: True

+ 2 - 1
jupysketch-doc/site/gallerydoc/index.html

@@ -249,7 +249,8 @@
                 
                 
                   <h1>Gallery</h1>
                   <h1>Gallery</h1>
                 
                 
-                <table>
+                <p><a href="../resources/Gallery/">The notebook</a></p>
+<table>
 <thead>
 <thead>
 <tr>
 <tr>
 <th align="center">Dry Friction</th>
 <th align="center">Dry Friction</th>

+ 1 - 1
jupysketch-doc/site/learningbyexample/index.html

@@ -530,7 +530,7 @@
 <p>The example we are developing now is based upon the "Dry Friction mockup" notebook</p>
 <p>The example we are developing now is based upon the "Dry Friction mockup" notebook</p>
 <ul>
 <ul>
 <li>the rendered html version of the notbook can be viewed <a href="../resources/DryFriction.html">here</a></li>
 <li>the rendered html version of the notbook can be viewed <a href="../resources/DryFriction.html">here</a></li>
-<li>the notebook can be download <a href="../resources/DryFriction.ipynb">here</a></li>
+<li>the notebook can be download <a href="../resources/DryFriction/">here</a></li>
 </ul>
 </ul>
 <h3 id="the-yaml-definition">The yaml definition</h3>
 <h3 id="the-yaml-definition">The yaml definition</h3>
 <p>Sketcher language is defined as a yaml compliant file or string. The yaml file is a dictionnary of "objects". Objects can be regular python objects or sketcher objects.
 <p>Sketcher language is defined as a yaml compliant file or string. The yaml file is a dictionnary of "objects". Objects can be regular python objects or sketcher objects.

Diferenças do arquivo suprimidas por serem muito extensas
+ 0 - 1172
jupysketch-doc/site/resources/DryFriction copy.ipynb


Diferenças do arquivo suprimidas por serem muito extensas
+ 0 - 1165
jupysketch-doc/site/resources/DryFriction.ipynb


Diferenças do arquivo suprimidas por serem muito extensas
+ 3009 - 0
jupysketch-doc/site/resources/DryFriction/index.html


Diferenças do arquivo suprimidas por serem muito extensas
+ 1700 - 0
jupysketch-doc/site/resources/Gallery/index.html


Diferenças do arquivo suprimidas por serem muito extensas
+ 1 - 1
jupysketch-doc/site/search/search_index.json


+ 7 - 7
jupysketch-doc/site/sitemap.xml

@@ -1,31 +1,31 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml version="1.0" encoding="UTF-8"?>
 <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><url>
 <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><url>
      <loc>None</loc>
      <loc>None</loc>
-     <lastmod>2020-08-11</lastmod>
+     <lastmod>2020-08-13</lastmod>
      <changefreq>daily</changefreq>
      <changefreq>daily</changefreq>
     </url><url>
     </url><url>
      <loc>None</loc>
      <loc>None</loc>
-     <lastmod>2020-08-11</lastmod>
+     <lastmod>2020-08-13</lastmod>
      <changefreq>daily</changefreq>
      <changefreq>daily</changefreq>
     </url><url>
     </url><url>
      <loc>None</loc>
      <loc>None</loc>
-     <lastmod>2020-08-11</lastmod>
+     <lastmod>2020-08-13</lastmod>
      <changefreq>daily</changefreq>
      <changefreq>daily</changefreq>
     </url><url>
     </url><url>
      <loc>None</loc>
      <loc>None</loc>
-     <lastmod>2020-08-11</lastmod>
+     <lastmod>2020-08-13</lastmod>
      <changefreq>daily</changefreq>
      <changefreq>daily</changefreq>
     </url><url>
     </url><url>
      <loc>None</loc>
      <loc>None</loc>
-     <lastmod>2020-08-11</lastmod>
+     <lastmod>2020-08-13</lastmod>
      <changefreq>daily</changefreq>
      <changefreq>daily</changefreq>
     </url><url>
     </url><url>
      <loc>None</loc>
      <loc>None</loc>
-     <lastmod>2020-08-11</lastmod>
+     <lastmod>2020-08-13</lastmod>
      <changefreq>daily</changefreq>
      <changefreq>daily</changefreq>
     </url><url>
     </url><url>
      <loc>None</loc>
      <loc>None</loc>
-     <lastmod>2020-08-11</lastmod>
+     <lastmod>2020-08-13</lastmod>
      <changefreq>daily</changefreq>
      <changefreq>daily</changefreq>
     </url>
     </url>
 </urlset>
 </urlset>

BIN
jupysketch-doc/site/sitemap.xml.gz


+ 1 - 0
postBuild

@@ -4,6 +4,7 @@ conda update -y jupyterlab
 pip install jupyter-server-proxy
 pip install jupyter-server-proxy
 pip install mkdocs
 pip install mkdocs
 pip install mkdocs-material
 pip install mkdocs-material
+pip install mkdocs-jupyter
 pip install git+https://github.com/pycontribs/ruyaml.git
 pip install git+https://github.com/pycontribs/ruyaml.git
 pip install ipywidgets
 pip install ipywidgets
 jupyter labextension update --all
 jupyter labextension update --all