feat: Automatic print start dialog on upload - #2223
Conversation
|
Language file analysis report:
|
59875fc to
30cc407
Compare
|
Language file analysis report:
|
| const latestKnownGcodeFileTime = Number(localStorage.getItem('latestKnownGcodeFileTime') ?? 0) | ||
| if (file && file.modified > latestKnownGcodeFileTime) { | ||
| localStorage.setItem('latestKnownGcodeFileTime', String(file.modified)) | ||
| if (latestKnownGcodeFileTime > 0 && this.showPrintOnUpload) |
There was a problem hiding this comment.
One thing i've kind of been on the fence with here is perhaps maybe we should add an additional condition that the modified timestamp is within the last 5 minutes or so? The reason being, if I've got multiple instances of mainsail that I use with the "showPrintOnUpload" setting enabled, then lets say i send a print and go to mainsail, the dialog is presented, and i go ahead an hit print (or cancel). Then later I open another mainsail instance with the setting turned on, it would see there is a new gcode file with a timestamp newer than what it had saved in its localStorage, so it would present the dialog for the other instance.
Or alternatively, perhaps we save the latestKnownGcodeFileTime in the moonraker db, so we can track the latest one any of the mainsail instances have seen? The main caveat there is AFAICT the moonraker db stuff isn't actively updated (nor do I see a way to subscribe to changes to the db), so that means if there are multiple instances already open, they could have stale latestKnownGcodeFileTime attributes.
When Mainsail is installed as an app on a desktop, it should get configured as an application that supports opening ".gcode" files. So you can either directly association gcode files to it, or right-click > Open With > Mainsail. When you do this, the file will get uploaded to the server and then open the print start dialog so that you can review and start the print.
30cc407 to
75e05e7
Compare
|
Language file analysis report:
|
Description
This PR adds a couple ways to have the start print dialog automatically open.
localStorage). I would expect people would want it enabled in their slicer, but probably not anywhere else. By default if the browser user agent contains "slicer", then I am enabling this setting (but can be overwritten by toggling the setting). Note: I only verified Orca Slicer, but it presents a user agent that starts with "BBL-Slicer".Related Tickets & Documents
Mobile & Desktop Screenshots/Recordings
Note
The recordings show the application with the new Happy Hare functionality, but none of my changes are dependent on that functionality. I've just simply cherry-picked my commits from my HH fork onto a new branch from the mainline
developbranch.PWA "Open With"
This demonstrates opening a gcode file with the "installed" Mainsail application (side note: I believe a user would need to re-install the application for it to set up that file type association).
Screen.Recording.2025-05-21.at.10.53.26.PM.mp4
Show Print on Upload
This demonstrates slicing a file and then using the "upload" along with the option to show the device page after uploading, which then automatically takes you to Mainsail after uploading and the start print dialog is displayed and the user may then start the print, perform tool mapping and then start the print, etc.
Screen.Recording.2025-05-21.at.10.55.23.PM.mp4
[optional] Are there any post-deployment tasks we need to perform?