Merge branch 'maintenance' into filefolder-rename
This commit is contained in:
21 files changed
+316
-626
No files matched your search
@@ -794,6 +794,7 @@ def gcodeFileCommand(filename, target):
|
||||
# valid file commands, dict mapping command name to mandatory parameters
|
||||
valid_commands = {
|
||||
"select": [],
|
||||
"unselect": [],
|
||||
"slice": [],
|
||||
"analyse": [],
|
||||
"copy": ["destination"],
|
||||
@@ -842,6 +843,26 @@ def gcodeFileCommand(filename, target):
|
||||
filenameToSelect = fileManager.path_on_disk(target, filename)
|
||||
printer.select_file(filenameToSelect, sd, printAfterLoading, user)
|
||||
|
||||
elif command == "unselect":
|
||||
with Permissions.FILES_SELECT.require(403):
|
||||
if not printer.is_ready():
|
||||
return make_response(
|
||||
"Printer is already printing, cannot unselect current file", 409
|
||||
)
|
||||
|
||||
_, currentFilename = _getCurrentFile()
|
||||
if currentFilename is None:
|
||||
return make_response(
|
||||
"Cannot unselect current file when there is no file selected", 409
|
||||
)
|
||||
|
||||
if filename != currentFilename and filename != "current":
|
||||
return make_response(
|
||||
"Only the currently selected file can be unselected", 400
|
||||
)
|
||||
|
||||
printer.unselect_file()
|
||||
|
||||
elif command == "slice":
|
||||
with Permissions.SLICE.require(403):
|
||||
if not _verifyFileExists(target, filename):
|
||||
|
||||
Reference in new issue
Block a user