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

Callback for loading/saving extra printer data in state file #91

Open
tillkamppeter opened this issue Nov 24, 2020 · 11 comments
Open

Callback for loading/saving extra printer data in state file #91

tillkamppeter opened this issue Nov 24, 2020 · 11 comments
Assignees
Labels
enhancement New feature or request priority-low
Milestone

Comments

@tillkamppeter
Copy link
Contributor

Describe the solution you'd like
As described in issue #90 I want to add an extra page to the printer's web interface to allow setting the "Installable Options" PPD options for PostScript printers. As these options are not job options and they influence available choices and available vendor options (in the "Printing Defaults") I do not want to add them as vendor options.
The settings of these options need to be saved in the state file and loaded the next time the PostScript Printer Application gets started. Is there already a way to do this?
If not, it would be great if the functions papplSystemLoadState() and papplSystemSaveState() could call callback functions to load/save extra data for each printer.

@michaelrsweet
Copy link
Owner

@tillkamppeter OK, so if you really need to store other information, right now you just provide your own save callback and not the default one.

Installable options can be included as vendor options, which will get loaded and saved. Without an xxx-support attribute, they won't show up in the printer defaults UI or be allowed as job template attributes, but you can store text (IPP_TAG_TEXT) values in the xxx-default attributes (part of the driver attributes you initially set).

Beyond that we'd need serialization callbacks to encode/decode driver-specific data that could then be read/written by the default save/load callback functions, but I'm not sure that should be a 1.0 goal, particularly when the API and default load/save callbacks were written to ensure that you can copy and adapt them using only the public APIs...

@michaelrsweet michaelrsweet self-assigned this Nov 24, 2020
@michaelrsweet michaelrsweet added enhancement New feature or request priority-low labels Nov 24, 2020
@michaelrsweet michaelrsweet added this to the Future milestone Nov 24, 2020
@tillkamppeter
Copy link
Contributor Author

OK, the method creating vendor options and only providing xxx-default and no xxx-supported would serve for me, as I only need to save and reload the key/value pairs of the installable options.

@tillkamppeter
Copy link
Contributor Author

Independent of my special case of installable option settings I think it is not very useful to have as only way of customization the full replacement of the function for saving.

First, if you want to save what usually gets saved plus some extra, you had to copy the whole original function and add the lines for the some extra.

Second, you cannot replace the function for loading the state file, so you cannot load any data which got saved in addition by your custom saving function.

@michaelrsweet
Copy link
Owner

@tillkamppeter True about the load function, and at that point you'd have to implement your own papplMainloop equivalent...

@tillkamppeter
Copy link
Contributor Author

I would very much appreciate a solution here soon, as without extending the savable data I cannot implement the Installable Options for PostScript printers as I cannot save their settings.

@michaelrsweet
Copy link
Owner

@tillkamppeter see my original response. List the installable options as vendor keywords and PAPPL will load/save the choices for you. Beyond that you need to implement your own load/save functions.

@tillkamppeter
Copy link
Contributor Author

OK, will go the xxx-default without xxx-supported way for Installable Options. So then I think I have all what I need for the PostScript Printer Application.

@tillkamppeter
Copy link
Contributor Author

I have tried to follow your instructions, adding a vendor option named "installable-options" with only an "installable-options-default" IPP attribute of IPP_TAG_TEXT type and no "installable-options-supported" IPP attribute, with the intention of putting all the settings of the "Installable Options" group of the PPD file into this string as space-separated KEY=VALUE list. You told that such a vendor option will not show up on the "Printing Defaults" page.
Unfortunately, it shows up:
Screenshot from 2020-12-15 19-50-52
Is this a bug in PAPPL or have I to do this differently?

@michaelrsweet
Copy link
Owner

@tillkamppeter Bug, I'll work on a fix.

@michaelrsweet
Copy link
Owner

Tracking with issue #104.

@tillkamppeter
Copy link
Contributor Author

I got the "Installable Options" support for the PostScript Printer Application completely working now, using the method of a vendor option without ...-supported IPP attribute for saving the "Installable Options" settings and your call of the status callback from issue #107. Thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request priority-low
Projects
None yet
Development

No branches or pull requests

2 participants