Callback for when the file is ready to be selected and optionally printed. For SD file uploads this is only the case after they have finished streaming to the printer, which is why this callback is also used for the corresponding call to addSdFile. Selects the just uploaded file if either
(filename, absFilename, destination)
| 148 | return filename |
| 149 | |
| 150 | def selectAndOrPrint(filename, absFilename, destination): |
| 151 | """ |
| 152 | Callback for when the file is ready to be selected and optionally printed. For SD file uploads this is only |
| 153 | the case after they have finished streaming to the printer, which is why this callback is also used |
| 154 | for the corresponding call to addSdFile. |
| 155 | |
| 156 | Selects the just uploaded file if either selectAfterUpload or printAfterSelect are True, or if the |
| 157 | exact file is already selected, such reloading it. |
| 158 | """ |
| 159 | if selectAfterUpload or printAfterSelect or (currentFilename == filename and currentOrigin == destination): |
| 160 | printerManager().selectFile(absFilename, destination == FileDestinations.SDCARD, printAfterSelect) |
| 161 | |
| 162 | try: |
| 163 | filename, done = printer.fileManager.addFile(file, target, fileProcessingFinished) |
no test coverage detected