It started as a proof of concept, but I find it quite useful and simple to use.
This plug allows to:
Create new spools with brand, material, color, initial net weight and gross weight, and additional notes
Edit some spool info
Retire used-up spools
Record print jobs with date, description, spool, used filament weight, duration, and additional notes
Delete print jobs
View the remaining filament weight for each spool, which is automatically calculated based on the print jobs.
All data is saved in JSON files that are easily portable and human-readable.
I was worried about having hundreds of rows serialized and deserialized in JSON, but the plug is actually blazing fast and 300+ print jobs are loaded instantly and the remaining spool weight is also calculated instantly.
I understand that it’s a bit strange to develop something like this in SilverBullet, but I’m on a quest to reduce the number of places where I save my stuff, so here we are.
It depends on the system one is using, e.g. Prusa Connect. But I am not sure if that is even possible. Nevertheless, your plug-in is inspirational. Thanks for sharing.
I’m not a 100% sure, but you could probably use the lua syscalls to “inject” some lua functions into the global scope directly so users wouldn’t have to copy paste all that and could just call a simple function. Specifically lua.evalExpression
Another thing: Using document editors it would very very simple to implement an STL viewer. I haven’t gotten around to it … just a little inspiration
I admit that I’m still a bit confused about the integration between TypeScript/JavaScript and Lua, especially regaring the lifecycle of things. If you have a few moments to spare, maybe you could provide an example for me
Whoops, while trying to build an example, I noticed that there is no way for anyone to know if the lua environment has been rebuild. So I guess the lifecycle can be very confusing
@zef Maybe it would make sense to add such an event so plugs can inject lua code consistently. Or maybe even provide a new option in the manifest to include lua files .
(Another method would be to directly return the widget from a syscall, but this only works without event handlers, because you can’t serialize functions.)