Hi,
currently the SpoolManager-Plugin overwrites the Print-Button in the UI via JavaScript.
So, each time a print should start, the javascript prevents this, ask the plugin in the backend about the needed filament and if everything is fine, the orig. start function in called in the UI. Works and is simple to implement.
But I received this feature request: Choose spool popup instead of confirm popup? · Issue #85 · OllisGit/OctoPrint-SpoolManager · GitHub
The problem is that the print is started from the slicer via an API-Call and now I am looking for a "nice/clean" way to intercept this call to do the needed filament-check.
I have some (dirty) solutions in my mind:
- Listen for the event
STATE_STARTING
, stop/pause the print viaprinter.pause_print(...)
, do the check (inform user via_plugin_manager.send_plugin_message(...)
) and cancel or resume the print.
or
- Listening for special G-Code at the beginning of the file. E.g.
M117 checking filament
, pause print do the check and cancel or resume the print
Of course, one challenge is to wait for the feedback from the user to confirm continuing printing, if the browser is not open and the web socket-call could not send the message to the browser. Then I need to stop the whole print.
Is there a better way?
Any ideas?
Olli