allow .debug module to load for shared electron/debug modules. filter defines from macros. add bambu check before attempted file send

This commit is contained in:
Stewart Allen 2024-12-10 15:46:21 -05:00
commit fa116bf277
5 changed files with 8 additions and 3 deletions

3
app.js
View file

@ -335,9 +335,10 @@ function init(mod) {
if (dir.charAt(0) === '.') return;
const stats = fs.lstatSync(`${mod.dir}/${modpath}`);
if (!(stats.isDirectory() || stats.isSymbolicLink())) return;
const isDebugMod = util.isfile(PATH.join(mod.dir,modpath,".debug"));
const isElectronMod = util.isfile(PATH.join(mod.dir,modpath,".electron"));
if (ENV.electron && !isElectronMod) return;
if (!ENV.electron && isElectronMod) return;
if (!ENV.electron && isElectronMod && !isDebugMod) return;
try {
loadModule(mod, modpath);
} catch (error) {

View file

@ -13,6 +13,7 @@ const modTmp = path.join('tmp','mod');
fs.copySync("mod", modTmp, { dereference: true, filter:(src,dst) => {
const ok =
src === 'mod' ||
src.indexOf('mod/ext-bambu') === 0 ||
src.indexOf('mod/standalone') === 0 ||
src.indexOf('mod/node_modules') === 0;
// console.log(ok, src);

View file

@ -70,6 +70,7 @@
},
"scripts": {
"dev": "gs-app-server --debug",
"prod": "gs-app-server",
"start": "npm run prebuild && electron .",
"start-dev": "npm run prebuild && electron . --devel",
"start-dbg": "npm run prebuild && electron . --debugg",

View file

@ -230,7 +230,9 @@ FDM.export = function(print, online, ondone, ondebug) {
// with logic flow IF / ELIF / ELSE / END
// IF / IF is valid but will not nest
function appendSub(line, pad) {
if (line.indexOf(';; IF ') === 0) {
if (line.indexOf(';; DEFINE ') === 0) {
// ignore var declarations
} else if (line.indexOf(';; IF ') === 0) {
line = line.substring(6).trim();
let evil = print.constReplace(line, subst, 0, 666);
subon = evil;

View file

@ -635,7 +635,7 @@ function exportGCodeDialog(gcode, sections, info, names) {
api.show.progress(progress.percent/100, "generating 3mf");
}, output => {
api.show.progress(0);
if (api.bambu) {
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`);