add separate bambu download button when device defines present

This commit is contained in:
Stewart Allen 2024-12-14 01:31:06 -05:00
commit 9ae2efcc72
3 changed files with 17 additions and 7 deletions

View file

@ -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);
})
};

View file

@ -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;

View file

@ -605,6 +605,7 @@
<button id="print-palette" class="grow">palette</button>
<button id="print-zip" class="grow">zip</button>
<button id="print-3mf" class="grow">3mf</button>
<button id="print-bambu" class="grow">bambu</button>
</div>
<div id="send-to-octohead" class="header"><label>octoprint</label></div>
<div id="send-to-octoprint" class="f-col box">