-
-
Notifications
You must be signed in to change notification settings - Fork 852
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
Printing options #5786
Printing options #5786
Conversation
✅ Deploy Preview for inventree-web-pui-preview ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
I would prefer option 1 but if the solution works I would not object to either. My opinion regarding new features in CUI is probably known. |
Maybe I just implement option 1 and sometime later if we can refactor the label app to only have one table, better api endpoints, ... and then implement the printing options like in option 2. Or what do you think @SchrodingersGat especially with the app support, do you want to just implement the dependent field in the app form framework and then everything works, or do you think its better to implement the dynamic options fetching depending on the selected plugin in all clients (options 1)? |
@SchrodingersGat @matmair This would now be ready for review. I updated the initial PR description and added some docs + testing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice and simple changeset; must have been a good amount of work to get it this simple; Looks great to me;
Please address (at least) the blocking remarks, nothing major in there though.
@wolflu05 API version needs fixing again! Ping me when that's updated and I'll review again for you |
@SchrodingersGat done. One side question, do I need to update the date in the api_version.py so that it is in sequence with the version numbers or can I leave the date like matmair did recently? |
I don't think it overly matters if the dates are out of sync a bit |
![]() Using this as an opportunity to implement inventree/inventree-brother-plugin#30 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM and works well on my end
@wolflu05 happy to merge? |
Yes, happy to merge now. I'm currently preparing another pr related to #4824 (hopefully the last so that everything for the machine registry is in place) which will add some tiny non breaking adjustments to the printing options. |
Thanks for all your work here @wolflu05 :) |
Hi folks! I am very glad that it got implemented! |
This PR should implement printing options to allow printing plugins to expose some options that can be set on each printing job from within the printing dialog, that get passed to the printing function on the plugin to dynamically control e.g. orientation, black/white mode, ... I think this gets also pretty interesting in combination with #4805 (@martonmiklos) to allow to skip certain grid positions to reuse a not fully used A4 label sheet on a regular printer.
Initial concept idea summary
This could look something like this, but keep in mind, this is just a mockup, that is not yet implemented, as the CUI code is not that easy. I described it a bit below.
![image](https://private-user-images.githubusercontent.com/76838159/277930608-2a5dc1b9-35c6-434a-8da1-fc344b7032cf.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzMzcwNzksIm5iZiI6MTczOTMzNjc3OSwicGF0aCI6Ii83NjgzODE1OS8yNzc5MzA2MDgtMmE1ZGMxYjktMzVjNi00MzRhLThkYTEtZmMzNDRiNzAzMmNmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEyVDA1MDYxOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTRjNjExZTA4ZGMwMzhmYjQ5Y2M0NTQyNTNjYjQxMTE5NmFkNjcxZWIwZGJkZDIyMWQ4ZWNhZWM1ZGY5MGExMzgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.rK6L2WLHUNcnOiqp7OJibkitRGR70QGd5xDX4coGLYI)
This is not yet ready. I created this PR as a discussion base. Basically I see two options.
Dependent field
What I already implemented is a new serializer field called
DependentField
. The following example should illustrate the functionality. Basically the client now needs to send an OPTIONS request with the fields that are already filled out e.g.{"a": "Test"}
, and then the DependentField called the defined field_serializer method with the body, which then could resolve in a serializer or None which the frontend should then just update on his displayed field list. This should also work nested. Im pretty sure this will be easy to implement in PUI, but I want to still support CUI. (If we don't go with the second approach, I will still need this DependetField for the machine integration, as the machines should be able to expose options too. But there I first need to select the plugin, then the machine, and then I could resolve the correct options from the machine driver definition via a DependentField.)Please let me know your thought and if something is unclear, I tried to explain it a bit better here with some examples.
I collapsed the initial design concept options above as they are not relevant anymore. I now decided to go with my option 1 and maybe later if the label app gets refactored, some time (so that it only has one label table to simplify everything that has to do with labels), option 2 can be build. That's also why I added the
printing_options
as a kwarg, so that we don't have to break the plugin API later if we want to send the printing options not directly in the request body, but using a dependent field or something else.This PR is ready for review now. I added a section in the documentation for plugin developers about how to use the printing options. Implementing this in PUI is another task, as there is basically nothing regarding printing already.