Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Layer use data['progress']['completion'] instead of recompute from "filepos" #6

Open
celogeek opened this issue Sep 3, 2018 · 4 comments

Comments

@celogeek
Copy link

celogeek commented Sep 3, 2018

Hi,

I'm currently writing a plugin that changes the "completion" in data progress to a "completion" based on time.
https://github.com/celogeek/OctoPrint-ProgressBasedOnTime/blob/master/octoprint_ProgressBasedOnTime/__init__.py

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 ?

@celogeek
Copy link
Author

celogeek commented Sep 3, 2018

something like this:
celogeek@67d933a

@chatrat12
Copy link
Owner

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?

@chatrat12
Copy link
Owner

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.

@celogeek
Copy link
Author

celogeek commented Sep 4, 2018

yeah. in fact it would be better to patch octoprint.
for example add 2 new thing:
file_completion, time_completion.

Then let "completion" untouch, or may be deprecate it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants