passing state into config
This commit is contained in:
@@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
import bbctrl.RequestHandler
|
import bbctrl
|
||||||
import pkg_resources
|
import pkg_resources
|
||||||
from pkg_resources import Requirement, resource_filename
|
from pkg_resources import Requirement, resource_filename
|
||||||
|
|
||||||
@@ -55,9 +55,10 @@ 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):
|
def update_gcode_list(self):
|
||||||
RequestHandler_Instance=bbctrl.RequestHandler(app=None, request=None)
|
ctrl_Instance = bbctrl.Ctrl()
|
||||||
self.values['gcodeList'] = RequestHandler_Instance.get_ctrl().state.return_files()
|
state_Instance=bbctrl.State(ctrl_Instance)
|
||||||
|
files = state_Instance.get('files', ["non_came.ngc"])
|
||||||
|
self.values['gcodeList'] = files
|
||||||
|
|
||||||
def load(self):
|
def load(self):
|
||||||
path = self.ctrl.get_path('config.json')
|
path = self.ctrl.get_path('config.json')
|
||||||
@@ -70,7 +71,7 @@ class Config(object):
|
|||||||
try:
|
try:
|
||||||
self._upgrade(config)
|
self._upgrade(config)
|
||||||
self.update_gcode_list()
|
self.update_gcode_list()
|
||||||
config['gcodeList'] = self.get('gcodeList', [])
|
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:
|
||||||
|
|||||||
Reference in New Issue
Block a user