Hi - developing yet another filament watching plugin. I'm using PNotify to pop a dialog warning when the print is paused by code. As below:
new PNotify({
title: 'Print Paused',
text: 'Print paused on filament alarm',
type: 'error',
animate-speed: 'fast'
});
When I do this, the dialog doesn't immediately show if the print is still in progress - Octoprint 'holds it' until the print ends or is canceled. Then all the PNotify's that were created appear. I've looked at a couple other plugins that do similar things (presumably without the same problem) and I think my code is very similar. Any thoughts?
On a related note, is there a command to pop up a similar dialog directly from the python side? Haven't run across one, but I'm pretty newbie-ish at this.
Using Octoprint 1.3.11 on Octopi and Chrome 74.0.3729.169 (Official Build) on Win 10 (64-bit).
Thx,
Gene
You would use send_plugin_message to send data to the javascript web ui side and then act on it from there. If you look at my M117PopUp plugin you'll see how it's handled in the AlertM117 function.
Yes that is exactly what I'm doing. And thanks to you specifically - M117PopUp was one of my reference plugins! Fortunately I was already sending messages with send_plugin_message, but it's a bummer that there is no "single-step" way to pop a message from the server side. It's entirely conceivable to have a plugin that has no UI/javascript. Having to add all that extra code just to pop a message is...cumbersome. Enhancement request?
I think even as an enhancement request the process would basically be the same, so I don't see any way around it. Without seeing the code on how you are processing/monitoring the serial communication though makes it difficult to assist any further. Is your code on github somewhere that we can look at?
I'll get it up there soon. I need to do a little cleanup before it's presentable
Just to confirm (keep in mind my inexperience ) - I'm correct in assuming a PNotify created during an active or paused print would pop immediately, right? I guess so or your M117PopUp wouldn't be very useful. I'd hate to be chasing somethings that's WAD.
Ok I found the error...er...errorS. One was the
animate-speed: 'fast'
...that creates an exception in the javascript. I had thrown that in after running across it doing PNotify research, but that doesn't work in this case. So it became noise in my search for a solution.
But the "holding the notification" problem was an error in my code on the python side, so I apologize for wasting everyone's time.
Thanks again,
Gene