mirror of
https://github.com/Dark98/SliceBeam.git
synced 2026-07-07 08:49:06 +00:00
Fix Config File Generation
This commit is contained in:
@@ -101,13 +101,26 @@ public class SliceBeam extends Application {
|
|||||||
|
|
||||||
public static ConfigObject buildCurrentConfigObject() {
|
public static ConfigObject buildCurrentConfigObject() {
|
||||||
ConfigObject singleObject = new ConfigObject();
|
ConfigObject singleObject = new ConfigObject();
|
||||||
singleObject.values.putAll(SliceBeam.CONFIG.findPrinter(SliceBeam.CONFIG.presets.get("printer")).values);
|
ConfigObject printerConfig = SliceBeam.CONFIG.findPrinter(SliceBeam.CONFIG.presets.get("printer"));
|
||||||
if (SliceBeam.CONFIG.findPrint(SliceBeam.CONFIG.presets.get("print")) != null) {
|
if (printerConfig != null) {
|
||||||
singleObject.values.putAll(SliceBeam.CONFIG.findPrint(SliceBeam.CONFIG.presets.get("print")).values);
|
singleObject.values.putAll(printerConfig.values);
|
||||||
|
}
|
||||||
|
ConfigObject printConfig = SliceBeam.CONFIG.findPrint(SliceBeam.CONFIG.presets.get("print"));
|
||||||
|
if (printConfig != null) {
|
||||||
|
for (Map.Entry<String, String> en : printConfig.values.entrySet()) {
|
||||||
|
if (!Slic3rConfigWrapper.PRINTER_CONFIG_KEYS.contains(en.getKey())) {
|
||||||
|
singleObject.values.put(en.getKey(), en.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// TODO: MMU. Detect by printerConfig#getExtruderCount()
|
// TODO: MMU. Detect by printerConfig#getExtruderCount()
|
||||||
if (SliceBeam.CONFIG.findFilament(SliceBeam.CONFIG.presets.get("filament")) != null) {
|
ConfigObject filamentConfig = SliceBeam.CONFIG.findFilament(SliceBeam.CONFIG.presets.get("filament"));
|
||||||
singleObject.values.putAll(SliceBeam.CONFIG.findFilament(SliceBeam.CONFIG.presets.get("filament")).values);
|
if (filamentConfig != null) {
|
||||||
|
for (Map.Entry<String, String> en : filamentConfig.values.entrySet()) {
|
||||||
|
if (!Slic3rConfigWrapper.PRINTER_CONFIG_KEYS.contains(en.getKey())) {
|
||||||
|
singleObject.values.put(en.getKey(), en.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PrintConfigDef def = PrintConfigDef.getInstance();
|
PrintConfigDef def = PrintConfigDef.getInstance();
|
||||||
@@ -121,12 +134,10 @@ public class SliceBeam extends Application {
|
|||||||
|
|
||||||
public static void genCurrentConfig() throws IOException {
|
public static void genCurrentConfig() throws IOException {
|
||||||
File cfg = getCurrentConfigFile();
|
File cfg = getCurrentConfigFile();
|
||||||
if (!cfg.exists()) {
|
FileOutputStream fos = new FileOutputStream(cfg);
|
||||||
FileOutputStream fos = new FileOutputStream(cfg);
|
ConfigObject singleObject = buildCurrentConfigObject();
|
||||||
ConfigObject singleObject = buildCurrentConfigObject();
|
fos.write(singleObject.serialize().getBytes(StandardCharsets.UTF_8));
|
||||||
fos.write(singleObject.serialize().getBytes(StandardCharsets.UTF_8));
|
fos.close();
|
||||||
fos.close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static File getCurrentConfigFile() {
|
public static File getCurrentConfigFile() {
|
||||||
|
|||||||
Reference in New Issue
Block a user