trying to add another config for gcodeList

This commit is contained in:
sanjayk03-dev
2024-01-22 11:04:03 +05:30
parent ddbbd56b15
commit b55be55af4
2 changed files with 17 additions and 2 deletions

View File

@@ -41,6 +41,7 @@ class Config(object):
self.log = ctrl.log.get('Config')
self.values = {}
self.values['gcodeList'] = []
try:
self.version = "1.4.0"
@@ -52,6 +53,9 @@ class Config(object):
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):
path = self.ctrl.get_path('config.json')
@@ -63,6 +67,8 @@ class Config(object):
try:
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 as e:
@@ -85,6 +91,8 @@ class Config(object):
self._upgrade(config)
self._update(config, False)
config['gcodeList'] = self.get('gcodeList')
with open(self.ctrl.get_path('config.json'), 'w') as f:
json.dump(config, f, indent=2)