Implement basic CRUD around required first step Cura settings
This commit is contained in:
parent
40650f1bde
commit
d6b172c744
5 changed files with 59 additions and 33 deletions
|
|
@ -4,6 +4,9 @@ __license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agp
|
|||
import logging
|
||||
import subprocess
|
||||
|
||||
APPNAME="OctoPrint"
|
||||
|
||||
|
||||
class CuraFactory(object):
|
||||
|
||||
CURA_PATH = '/home/rosshendrickson/workspaces/opensource/CuraEngine/CuraEngine'
|
||||
|
|
|
|||
|
|
@ -452,7 +452,12 @@ 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"])
|
||||
}
|
||||
})
|
||||
|
||||
@app.route(BASEURL + "settings", methods=["POST"])
|
||||
|
|
@ -499,6 +504,22 @@ 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)
|
||||
|
||||
if cura_engine:
|
||||
|
||||
cura_enabled = cura_engine.get("cura_enabled")
|
||||
if cura_enabled:
|
||||
s.setBoolean(["cura_engine", "cura_path"], cura_enabled)
|
||||
|
||||
cura_path = cura_engine.get("cura_path")
|
||||
if cura_path:
|
||||
s.set(["cura_engine", "cura_path"], cura_path)
|
||||
|
||||
cura_config = cura_engine.get("cura_config")
|
||||
if cura_config:
|
||||
s.set(["cura_engine", "cura_config"], cura_config)
|
||||
|
||||
s.save()
|
||||
|
||||
return getSettings()
|
||||
|
|
|
|||
|
|
@ -80,11 +80,11 @@ default_settings = {
|
|||
"userManager": "octoprint.users.FilebasedUserManager",
|
||||
"userfile": None
|
||||
},
|
||||
"curaEngine": {
|
||||
"enabled": True,
|
||||
"cura_path": "",
|
||||
"cura_config": ""
|
||||
}
|
||||
"cura_engine": {
|
||||
"cura_enabled": True,
|
||||
"cura_path": "/something/wicked/this/way/comes/",
|
||||
"cura_config": "/here/there/be/dragons"
|
||||
}
|
||||
}
|
||||
|
||||
valid_boolean_trues = ["true", "yes", "y", "1"]
|
||||
|
|
|
|||
|
|
@ -1340,9 +1340,10 @@ function SettingsViewModel(loginStateViewModel, usersViewModel) {
|
|||
self.folder_timelapse = ko.observable(undefined);
|
||||
self.folder_timelapseTmp = ko.observable(undefined);
|
||||
self.folder_logs = ko.observable(undefined);
|
||||
|
||||
self.cura_engine_path = ko.observable(undefined);
|
||||
self.cura_config_path = ko.observable(undefined);
|
||||
|
||||
self.cura_enabled = ko.observable(undefined);
|
||||
self.cura_path = ko.observable(undefined);
|
||||
self.cura_config = ko.observable(undefined);
|
||||
|
||||
self.temperature_profiles = ko.observableArray(undefined);
|
||||
|
||||
|
|
@ -1391,9 +1392,9 @@ function SettingsViewModel(loginStateViewModel, usersViewModel) {
|
|||
self.folder_timelapseTmp(response.folder.timelapseTmp);
|
||||
self.folder_logs(response.folder.logs);
|
||||
|
||||
self.cura_enabled(response.curaEngine.cura_enabled);
|
||||
self.cura_engine_path(response.curaEngine.cura_path);
|
||||
self.cura_config_path(response.curaEngine.config_path);
|
||||
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.temperature_profiles(response.temperature.profiles);
|
||||
|
||||
|
|
@ -1439,10 +1440,10 @@ function SettingsViewModel(loginStateViewModel, usersViewModel) {
|
|||
"system": {
|
||||
"actions": self.system_actions()
|
||||
},
|
||||
"curaEngine": {
|
||||
"cura_engine": {
|
||||
"enabled": self.cura_enabled(),
|
||||
"cura_path": self.cura_engine_path(),
|
||||
"cura_config": self.cura_config_path()
|
||||
"cura_path": self.cura_path(),
|
||||
"cura_config": self.cura_config()
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,23 +17,6 @@
|
|||
</ul>
|
||||
|
||||
<div class="tab-content span8">
|
||||
<div class="tab-pane active" id="settings_cura">
|
||||
<form class="form-horizontal">
|
||||
<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_engine_path">
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="settings-curaPath">Cura Config</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="input-block-level" data-bind="value: cura_config_path">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane active" id="settings_printerParameters">
|
||||
<form class="form-horizontal">
|
||||
<div class="control-group">
|
||||
|
|
@ -224,7 +207,25 @@
|
|||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<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>
|
||||
<div class="controls">
|
||||
<input type="checkbox" data-bind="value: cura_enabled">
|
||||
</div>
|
||||
<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 class="controls">
|
||||
<input type="text" class="input-block-level" data-bind="value: cura_config">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
{% if enableAccessControl %}
|
||||
<div class="tab-pane" id="settings_users">
|
||||
<table class="table table-condensed table-hover" id="system_users">
|
||||
|
|
|
|||
Loading…
Reference in a new issue