michaelrsweet / pappl

PAPPL - Printer Application Framework
https://www.msweet.org/pappl
Apache License 2.0
309 stars 49 forks source link

Web Interface: On the "Add printer" screen in the driver dropdown list, allow a default item being pre-selected #74

Closed tillkamppeter closed 3 years ago

tillkamppeter commented 3 years ago

Is your feature request related to a problem? Please describe. If you add a printer using the web interface you get four items to fill: The queue name, the discovered printer, the printer's host name/IP address if your network printer did not get discovered, the driver. The drop-downs, printer device and driver, are set to "Select device" and "Select driver" resp. In my PostScript Printer Application I have a driver list starting with "Automatic Selection" and "Generic Printers" and then thousands of explicit printer models. In most cases one simply chooses "Automatic Selection" and does not need to hassle with the long list. So I would like to have "Automatic Selection" already selected and the "Select driver" not added to the list.

Describe the solution you'd like The papplSystemSetPrinterDrivers() should have an extra integer argument which is the index of the default choice in the list, or -1 if one wants "Select driver" being added as first item and selected. This way I could set it 0 (first item in the list) to pre-select "Automatic Selection" in the ps_setup() function of the PostScript Printer Application.

michaelrsweet commented 3 years ago

I think the solution should be for the driver not to list "auto", but instead make the current pappl_ml_autoadd_cb_t callback part of the core functionality. If set, 'auto' will be available as a virtual driver that triggers a lookup of the actual named driver.

There is also the papplSystemMatchDriver function, which uses the IEEE-1284 device ID. If that is sufficient, we can just list the 'auto' if the drivers list includes device IDs.

tillkamppeter commented 3 years ago

Not all the drivers (~4000 PPD files) have device IDs and I also want to always check the CMD: for PostScript to assure that if a printer needs an add-on module for PostScript that the module is actually installed. Therefore I prefer to have my own callback to do the device ID/driver matching. Using the same callback (in my case ps_autoadd()) for auto-selection when manually adding a printer and for the "autoadd" subcommand saves duplicate code and makes the Printer Application react more consistently about which driver to auto-select for a given piece of hardware. Instead of having "Automatic Selection" in the list of drivers one could alternatively have a button for driver auto-selection, as I suggested in Issue #56.

michaelrsweet commented 3 years ago

@tillkamppeter I've made changes to the API to incorporate the auto-add callback into the normal driver stuff. The name "auto" now triggers auto-detection and is propagated to the web interface, command-line, and IPP.

[master 90b1bb9] Add auto-add callback as a top-level system thing, "auto" as a driver name, etc. (Issue #74)

Let me know if you run into any problems.

michaelrsweet commented 3 years ago

I think this addresses the last request (to have it pre-selected):

[master 3b20f5b] Don't bother showing 'select driver' item if we have an auto-add callback (Issue #74)