From 00380ac6020179de15929afc1b29b7dc5ce094e4 Mon Sep 17 00:00:00 2001 From: jaseg Date: Sun, 29 Sep 2019 13:30:38 +0200 Subject: Add STL renderer --- .gitmodules | 3 +++ webapp/pogojig.py | 9 ++++++--- webapp/static/Madeleine.js | 1 + webapp/static/style.css | 8 ++++++++ webapp/templates/jigerator.html | 21 ++++++++++++++++++--- 5 files changed, 36 insertions(+), 6 deletions(-) create mode 100644 .gitmodules create mode 160000 webapp/static/Madeleine.js diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..94f2319 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "webapp/static/Madeleine.js"] + path = webapp/static/Madeleine.js + url = https://github.com/JinJunho/Madeleine.js diff --git a/webapp/pogojig.py b/webapp/pogojig.py index baaca5a..9312cf5 100644 --- a/webapp/pogojig.py +++ b/webapp/pogojig.py @@ -93,9 +93,12 @@ def upload_svg(): flash(f'Error uploading SVG file: {"; ".join(msg for elem in upload_form.errors.values() for msg in elem)}', 'error') return redirect(url_for('jigerator')) -@app.route('/render/download') -def render_download(): - return send_file(tempfile_path(f'renders.zip'), +@app.route('/render/download/') +def render_download(file): + if file not in ['jig.stl', 'pcb_shape.dxf', 'kicad.zip', 'sources.zip']: + abort(404) + + return send_file(tempfile_path(file), mimetype='application/zip', as_attachment=True, attachment_filename=f'{path.splitext(session["filename"])[0]}_pogojig.zip') diff --git a/webapp/static/Madeleine.js b/webapp/static/Madeleine.js new file mode 160000 index 0000000..9e39e65 --- /dev/null +++ b/webapp/static/Madeleine.js @@ -0,0 +1 @@ +Subproject commit 9e39e65b7257bc1139502a14970cc174ca594750 diff --git a/webapp/static/style.css b/webapp/static/style.css index 857541d..b9a696e 100644 --- a/webapp/static/style.css +++ b/webapp/static/style.css @@ -227,3 +227,11 @@ a.btn:active, a.btn:hover, a.btn:visited, a.btn:link { background-color: #d35f5f; box-shadow: 1px 2px 4px 1px #000; } + +.controls { + padding-top: 8em; +} + +.render_output { + padding-bottom: 8em; +} diff --git a/webapp/templates/jigerator.html b/webapp/templates/jigerator.html index 9ee9b84..15711b2 100644 --- a/webapp/templates/jigerator.html +++ b/webapp/templates/jigerator.html @@ -116,9 +116,9 @@ {% else %} {% endif %} @@ -132,5 +132,20 @@ + + + + + + + -- cgit