trying to add another config for gcodeList
This commit is contained in:
@@ -42,7 +42,6 @@ module.exports = {
|
|||||||
tab: "auto",
|
tab: "auto",
|
||||||
ask_home: true,
|
ask_home: true,
|
||||||
showGcodeMessage: false,
|
showGcodeMessage: false,
|
||||||
gcode_files:this.state.files.filter(item => !this.config.macrosList.some(compareItem => compareItem.gcode_file_name === item))
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -376,6 +375,11 @@ module.exports = {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(file.name);
|
||||||
|
if(this.state.macrosList.some(obj => obj.gcode_file_name == files.name)){
|
||||||
|
console.log("It is a macros, remove it from macrosList")
|
||||||
|
}
|
||||||
|
|
||||||
SvelteComponents.showDialog("Upload", {
|
SvelteComponents.showDialog("Upload", {
|
||||||
file,
|
file,
|
||||||
onComplete: () => {
|
onComplete: () => {
|
||||||
@@ -517,7 +521,10 @@ module.exports = {
|
|||||||
}catch(error){
|
}catch(error){
|
||||||
console.warn("Error running program: ",error);
|
console.warn("Error running program: ",error);
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
gcode_files: function (){
|
||||||
|
return this.state.files.filter(item => !this.config.macrosList.some(compareItem => compareItem.gcode_file_name === item))
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
mixins: [ require("./axis-vars") ]
|
mixins: [ require("./axis-vars") ]
|
||||||
|
|||||||
@@ -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"
|
||||||
@@ -52,6 +53,9 @@ class Config(object):
|
|||||||
|
|
||||||
except Exception: self.log.exception('Internal error: Failed to load config template')
|
except Exception: self.log.exception('Internal error: Failed to load config template')
|
||||||
|
|
||||||
|
def update_gcode_list(self, state):
|
||||||
|
self.values['gcodeList'] = state.files
|
||||||
|
|
||||||
|
|
||||||
def load(self):
|
def load(self):
|
||||||
path = self.ctrl.get_path('config.json')
|
path = self.ctrl.get_path('config.json')
|
||||||
@@ -63,6 +67,8 @@ class Config(object):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
self._upgrade(config)
|
self._upgrade(config)
|
||||||
|
config['gcodeList'] = self.get('gcodeList', [])
|
||||||
|
self.update_gcode_list(["Team Onefinity.ngc","4th.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:
|
||||||
@@ -85,6 +91,8 @@ class Config(object):
|
|||||||
self._upgrade(config)
|
self._upgrade(config)
|
||||||
self._update(config, False)
|
self._update(config, False)
|
||||||
|
|
||||||
|
config['gcodeList'] = self.get('gcodeList')
|
||||||
|
|
||||||
with open(self.ctrl.get_path('config.json'), 'w') as f:
|
with open(self.ctrl.get_path('config.json'), 'w') as f:
|
||||||
json.dump(config, f, indent=2)
|
json.dump(config, f, indent=2)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user