✨ Add print, select and userdata to Upload event

Implements #3604
This commit is contained in:
Gina Häußge committed 2020-06-18 15:41:16 +02:00
1 parent a9440eea88
commit 82b07ae8f2
2 files changed
+12 -4

No files matched your search

+4 -1
View File
@@ -197,12 +197,15 @@ File handling
-------------
Upload
A file has been uploaded through the web interface.
A file has been uploaded through the :ref:`REST API <sec-api-fileops-uploadfile>`.
Payload:
* ``name``: the file's name
* ``path``: the file's path within its storage location
* ``target``: the target storage location to which the file was uploaded, either ``local`` or ``sdcard``
* ``select``: whether the file will immediately be selected, as requested on the API by the corresponding parameter
* ``print``: whether the file will immediately start printing, as requested on the API by the corresponding parameter
* ``userdata``: optional ``userdata`` if provided on the API, will only be present if supplied in the upload request
.. deprecated:: 1.3.0
+8 -3
View File
@@ -425,9 +425,14 @@ def uploadGcodeFile(target):
if isinstance(filename, tuple):
filename, sdFilename = filename
eventManager.fire(Events.UPLOAD, {"name": futureFilename,
"path": filename,
"target": target})
payload = dict(name=futureFilename,
path=filename,
target=target,
select=selectAfterUpload,
print=printAfterSelect)
if userdata is not None:
payload["userdata"] = userdata
eventManager.fire(Events.UPLOAD, payload)
files = {}
location = url_for(".readGcodeFile", target=FileDestinations.LOCAL, filename=filename, _external=True)