back to config.py
This commit is contained in:
@@ -206,8 +206,7 @@ module.exports = {
|
|||||||
const filesWithNoMacros=this.state.files.filter(item => !this.config.macrosList.some(compareItem => compareItem.gcode_file_name == item));
|
const filesWithNoMacros=this.state.files.filter(item => !this.config.macrosList.some(compareItem => compareItem.gcode_file_name == item));
|
||||||
console.log('filesWithNoMacros: ',filesWithNoMacros);
|
console.log('filesWithNoMacros: ',filesWithNoMacros);
|
||||||
console.log("this.config.GCodeList",this.config.GCodeList)
|
console.log("this.config.GCodeList",this.config.GCodeList)
|
||||||
const GCodeListArray=this.config.GCodeList.map(item=> item['gcode_file_name'])
|
const unionSet = new Set([...filesWithNoMacros, ...this.config.GCodeList]);
|
||||||
const unionSet = new Set([...filesWithNoMacros, ...GCodeListArray]);
|
|
||||||
const files = [...unionSet];
|
const files = [...unionSet];
|
||||||
console.log("files: ",files);
|
console.log("files: ",files);
|
||||||
return files;
|
return files;
|
||||||
@@ -376,11 +375,10 @@ module.exports = {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const isAlreadyPresent = this.config.GCodeList.find((element) => element['gcode_file_name'] == file.name);
|
const isAlreadyPresent = this.config.GCodeList.find((element) => element == file.name);
|
||||||
if(isAlreadyPresent == undefined){
|
if(isAlreadyPresent == undefined){
|
||||||
console.log('new gcode file');
|
console.log('new gcode file');
|
||||||
const GCode={gcode_file_name: file.name }
|
this.config.GCodeList.push(file.name);
|
||||||
this.config.GCodeList.push(GCode);
|
|
||||||
try {
|
try {
|
||||||
await api.put("config/save", this.config);
|
await api.put("config/save", this.config);
|
||||||
this.$dispatch("update");
|
this.$dispatch("update");
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ class Config(object):
|
|||||||
self.log = ctrl.log.get('Config')
|
self.log = ctrl.log.get('Config')
|
||||||
|
|
||||||
self.values = {}
|
self.values = {}
|
||||||
|
self.values['GCodeList'] = []
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.version = "1.4.0"
|
self.version = "1.4.0"
|
||||||
@@ -62,6 +63,7 @@ class Config(object):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
self._upgrade(config)
|
self._upgrade(config)
|
||||||
|
config['GCodeList'] = self.get('GCodeList', ["Test.ngc"])
|
||||||
except Exception: self.log.exception('Internal error: Failed to upgrade config')
|
except Exception: self.log.exception('Internal error: Failed to upgrade config')
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
@@ -690,18 +690,6 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
"GCodeList": {
|
|
||||||
"type": "list",
|
|
||||||
"index": "numeric",
|
|
||||||
"default": [],
|
|
||||||
"template": {
|
|
||||||
"gcode_file_time": {
|
|
||||||
"type": "int",
|
|
||||||
"default": 1705008395
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
"admin": {
|
"admin": {
|
||||||
"auto-check-upgrade": {
|
"auto-check-upgrade": {
|
||||||
"type": "bool",
|
"type": "bool",
|
||||||
|
|||||||
Reference in New Issue
Block a user