Added external system commands support for events
Print start, print end, print cancel, and Z height change can now trigger external system commands. These are set in config.yaml and take _FILE_, _PERCENT_, _LINES_ and _ZHEIGHT_ tokens to be passed to external commands. system_commands: cancelled: echo cancelled _FILE_ at _PROGRESS_ percent done. print_done: echo done with _FILE_ print_started: echo starting _FILE_ z_change: echo _LINE_ _PROGRESS_ _ZHEIGHT_
This commit is contained in:
1 parent
957213321e
commit
3b66f63ff2
3 files changed
+602
-534
No files matched your search
+580
-532
File diff suppressed because it is too large.
Load diff
@@ -375,7 +375,15 @@ def getSettings():
|
||||
},
|
||||
"system": {
|
||||
"actions": s.get(["system", "actions"])
|
||||
},
|
||||
"system_commands": {
|
||||
"print_done": s.get(["system_commands", "print_done"]),
|
||||
"cancelled": s.get(["system_commands", "cancelled"]),
|
||||
"print_started": s.get(["system_commands", "print_started"]),
|
||||
"z_change": s.get(["system_commands", "z_change"])
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
@app.route(BASEURL + "settings", methods=["POST"])
|
||||
@@ -417,6 +425,12 @@ def setSettings():
|
||||
if "system" in data.keys():
|
||||
if "actions" in data["system"].keys(): s.set(["system", "actions"], data["system"]["actions"])
|
||||
|
||||
if "system_commands" in data.keys():
|
||||
if "z_change" in data["system_commands"].keys(): s.set(["system_commands", "z_change"], data["system_commands"]["z_change"])
|
||||
if "print_started" in data["system_commands"].keys(): s.set(["system_commands", "print_started"], data["system_commands"]["print_started"])
|
||||
if "cancelled" in data["system_commands"].keys(): s.set(["system_commands", "cancelled"], data["system_commands"]["cancelled"])
|
||||
if "print_done" in data["system_commands"].keys(): s.set(["system_commands", "print_done"], data["system_commands"]["print_done"])
|
||||
|
||||
s.save()
|
||||
|
||||
return getSettings()
|
||||
|
||||
@@ -69,8 +69,14 @@ default_settings = {
|
||||
"controls": [],
|
||||
"system": {
|
||||
"actions": []
|
||||
}
|
||||
}
|
||||
},
|
||||
"system_commands": {
|
||||
"z_change":None,
|
||||
"print_started":None,
|
||||
"cancelled":None,
|
||||
"print_done":None
|
||||
}
|
||||
}
|
||||
|
||||
valid_boolean_trues = ["true", "yes", "y", "1"]
|
||||
|
||||
|
||||
Reference in new issue
Block a user