Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Layer use data['progress']['completion'] instead of recompute from "filepos" #6
I'm currently writing a plugin that changes the "completion" in data progress to a "completion" based on time.
The completion here = Print Time / (Print Time + Time Left)
I have added "file_completion" to keep track of the previous value here.
It would be safer if possible to recompute the file progression based on the "filepos" information and the size of the file you may have kept somewhere.
Or is it possible to use the "file_completion" if it exists instead of completion ?
From what I understand you are looking for compliance from other plugins to not rely on data from the completion field to track file position because your plugin will change its value. If that is the case, I'm not sure I can support that. What if plugin devs don't get the memo and OctoPrint users are left chasing the ghost in the machine when things are not working because of the introduced conflict.
I agree that completion percentage based on file position is not the most useful data to the end user. For instance, if your GCode for some reason 90% comments, the results look odd to the user. Have you thought in about an opt in route instead of ripping out the original functionality? I'm sure there is a good way to accomplish your goal without creating conflicts in the plugin ecosystem :)
What are your thoughts?
I'll change it tomorrow if you want. I'm just a little concerned about the long term impact it could have on the plugin ecosystem. I imagine @foosel would agree. There is no way for other plugin authors to know that your plugin could possibly break theirs. My plugin is not the only one that uses 'completion' in the same manner mine does. I saw at least one other when looking at other projects as reference when learning how to author octoprint plugins.