Address PR naming comments. Ensure save and load of cura specific settings is working.
This commit is contained in:
parent
d6b172c744
commit
d7fe15d635
4 changed files with 39 additions and 29 deletions
|
|
@ -453,10 +453,10 @@ def getSettings():
|
|||
"system": {
|
||||
"actions": s.get(["system", "actions"])
|
||||
},
|
||||
"cura_engine": {
|
||||
"cura_enabled": s.get(["cura_engine", "cura_enabled"]),
|
||||
"cura_path": s.get(["cura_engine", "cura_path"]),
|
||||
"cura_config": s.get(["cura_engine", "cura_config"])
|
||||
"curaEngine": {
|
||||
"enabled": s.getBoolean(["curaEngine", "enabled"]),
|
||||
"path": s.get(["curaEngine", "path"]),
|
||||
"config": s.get(["curaEngine", "config"])
|
||||
}
|
||||
})
|
||||
|
||||
|
|
@ -504,21 +504,21 @@ def setSettings():
|
|||
if "system" in data.keys():
|
||||
if "actions" in data["system"].keys(): s.set(["system", "actions"], data["system"]["actions"])
|
||||
|
||||
cura_engine = data.get("cura_engine", None)
|
||||
curaEngine = data.get("curaEngine", None)
|
||||
|
||||
if cura_engine:
|
||||
if curaEngine:
|
||||
|
||||
cura_enabled = cura_engine.get("cura_enabled")
|
||||
if cura_enabled:
|
||||
s.setBoolean(["cura_engine", "cura_path"], cura_enabled)
|
||||
path = curaEngine.get("path")
|
||||
if path:
|
||||
s.set(["curaEngine", "path"], path)
|
||||
|
||||
cura_path = cura_engine.get("cura_path")
|
||||
if cura_path:
|
||||
s.set(["cura_engine", "cura_path"], cura_path)
|
||||
config = curaEngine.get("config")
|
||||
if config:
|
||||
s.set(["curaEngine", "config"], config)
|
||||
|
||||
cura_config = cura_engine.get("cura_config")
|
||||
if cura_config:
|
||||
s.set(["cura_engine", "cura_config"], cura_config)
|
||||
# Enabled is a boolean so we cannot check that we have a result
|
||||
enabled = curaEngine.get("enabled")
|
||||
s.setBoolean(["curaEngine", "enabled"], enabled)
|
||||
|
||||
s.save()
|
||||
|
||||
|
|
|
|||
|
|
@ -80,10 +80,10 @@ default_settings = {
|
|||
"userManager": "octoprint.users.FilebasedUserManager",
|
||||
"userfile": None
|
||||
},
|
||||
"cura_engine": {
|
||||
"cura_enabled": True,
|
||||
"cura_path": "/something/wicked/this/way/comes/",
|
||||
"cura_config": "/here/there/be/dragons"
|
||||
"curaEngine": {
|
||||
"enabled": True,
|
||||
"config": "/here/there/be/dragons/that/want/to/eat/you/",
|
||||
"path": "/here/there/be/dragons/that/want/to/eat/you/"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -140,6 +140,7 @@ class Settings(object):
|
|||
#~~ getter
|
||||
|
||||
def get(self, path):
|
||||
logging.info("SETTINGS:GET:%s" % path)
|
||||
if len(path) == 0:
|
||||
return None
|
||||
|
||||
|
|
@ -166,15 +167,20 @@ class Settings(object):
|
|||
results = []
|
||||
for key in keys:
|
||||
if key in config.keys():
|
||||
logging.info("USERSET")
|
||||
results.append(config[key])
|
||||
elif key in defaults:
|
||||
logging.info("DEFAULT")
|
||||
results.append(defaults[key])
|
||||
else:
|
||||
results.append(None)
|
||||
|
||||
if not isinstance(k, (list, tuple)):
|
||||
return results.pop()
|
||||
result = results.pop()
|
||||
logging.info("SETTINGS:GET:RESULT:%s" % str(result))
|
||||
return result
|
||||
else:
|
||||
logging.info("SETTINGS:GET:RESULTS:%s" % str(results))
|
||||
return results
|
||||
|
||||
def getInt(self, path):
|
||||
|
|
|
|||
|
|
@ -1392,9 +1392,9 @@ function SettingsViewModel(loginStateViewModel, usersViewModel) {
|
|||
self.folder_timelapseTmp(response.folder.timelapseTmp);
|
||||
self.folder_logs(response.folder.logs);
|
||||
|
||||
self.cura_enabled(response.cura_engine.cura_enabled);
|
||||
self.cura_path(response.cura_engine.cura_path);
|
||||
self.cura_config(response.cura_engine.config_path);
|
||||
self.cura_enabled(response.curaEngine.enabled);
|
||||
self.cura_path(response.curaEngine.path);
|
||||
self.cura_config(response.curaEngine.config);
|
||||
|
||||
self.temperature_profiles(response.temperature.profiles);
|
||||
|
||||
|
|
@ -1440,10 +1440,10 @@ function SettingsViewModel(loginStateViewModel, usersViewModel) {
|
|||
"system": {
|
||||
"actions": self.system_actions()
|
||||
},
|
||||
"cura_engine": {
|
||||
"curaEngine": {
|
||||
"enabled": self.cura_enabled(),
|
||||
"cura_path": self.cura_path(),
|
||||
"cura_config": self.cura_config()
|
||||
"path": self.cura_path(),
|
||||
"config": self.cura_config()
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -210,15 +210,19 @@
|
|||
<div class="tab-pane" id="settings_cura">
|
||||
<form class="form-horizontal">
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="settings-curaPath">Cura Enabled</label>
|
||||
<label class="control-label" for="settings-curaEnabled">Cura Enabled</label>
|
||||
<div class="controls">
|
||||
<input type="checkbox" data-bind="value: cura_enabled">
|
||||
<input type="checkbox" data-bind="checked: cura_enabled">
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="settings-curaPath">CuraEngine Path</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="input-block-level" data-bind="value: cura_path">
|
||||
</div>
|
||||
<label class="control-label" for="settings-curaPath">Cura Config</label>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="settings-curaConfig">Cura Config</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="input-block-level" data-bind="value: cura_config">
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in a new issue