From 9ae2efcc721cb89a31ea17c3fa5f6babca0cbefd Mon Sep 17 00:00:00 2001 From: Stewart Allen Date: Sat, 14 Dec 2024 01:31:06 -0500 Subject: [PATCH] add separate bambu download button when device defines present --- src/kiri/export.js | 15 ++++++++++----- web/kiri/index.css | 8 ++++++-- web/kiri/index.html | 1 + 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/kiri/export.js b/src/kiri/export.js index e8d6b2e1..65c1672b 100644 --- a/src/kiri/export.js +++ b/src/kiri/export.js @@ -521,6 +521,15 @@ function exportGCodeDialog(gcode, sections, info, names) { let download3MF = $('print-3mf'); download3MF.style.display = fdm ? 'flex' : 'none'; download3MF.onclick = function() { + gen3mf(zip => api.util.download(zip, `${$('print-filename').value}.3mf`)); + }; + let downloadBambu = $('print-bambu'); + downloadBambu.style.display = api.bambu && api.bambu.sendok({ gcode, info, settings }) ? 'flex' : 'none'; + downloadBambu.onclick = function() { + gen3mf(zip => api.bambu.send(`${$('print-filename').value}.3mf`, zip)); + } + + function gen3mf(then) { let files = [{ name: `[Content_Types].xml`, data: [ @@ -635,11 +644,7 @@ function exportGCodeDialog(gcode, sections, info, names) { api.show.progress(progress.percent/100, "generating 3mf"); }, output => { api.show.progress(0); - if (api.bambu && api.bambu.sendok({ gcode, info, settings })) { - api.bambu.send(`${$('print-filename').value}.3mf`, output); - } else { - api.util.download(output, `${$('print-filename').value}.3mf`); - } + then(output); }) }; diff --git a/web/kiri/index.css b/web/kiri/index.css index e43c67c3..62ba9c90 100644 --- a/web/kiri/index.css +++ b/web/kiri/index.css @@ -247,8 +247,12 @@ details[open] > summary::after { } .dark button { color: #fff; - background-color: #777; - border: 1px solid #999; + background-color: #555; + border: 1px solid #777; +} +button:hover { + background-color: var(--blue-2); + color: black; } .dark #progress { background-color: #333; diff --git a/web/kiri/index.html b/web/kiri/index.html index 7488f894..fbd1379c 100644 --- a/web/kiri/index.html +++ b/web/kiri/index.html @@ -605,6 +605,7 @@ +