Printing/AdminToolNewPrinter

= "New printer" dialog in the admin tool =

This page describes the actions that need to be taken when the user/admin clicks on "New printer" in system-config-printer.

A dialog will be displayed, and it will ask for a number of things:

A short description
(this is the 'printer-info')

A short location description
(this is the 'printer-location')

The device to use
(this is the 'printer-uri')

The available backends and any devices they already know about will be obtained using cups.Connection.getDevices. Some backends will just have a scheme name (such as 'lpd') and a description; others will provide complete URIs for available printers, complete with IEEE 1284 Device IDs in the 'device-id' attribute:

>>> import cups >>> cups.setServer("hoopoe") >>> c=cups.Connection >>> c.getDevices {'smb': {'device-class': 'network', 'device-make-and-model': 'Unknown', 'device-info': 'Windows Printer via SAMBA', 'device-id': ''}, 'http': {'device-class': 'network', 'device-make-and-model': 'Unknown', 'device-info': 'Internet Printing Protocol (http)', 'device-id': ''}, [...] 'usb://HP/DeskJet%20990C?serial=US05N1J00XLG': {'device-class': 'direct', 'device-make-and-model': 'HP DeskJet 990C', 'device-info': 'HP DeskJet 990C USB #1', 'device-id': 'MFG:HEWLETT-PACKARD;MDL:DESKJET 990C;CMD:MLC,PCL,PML;CLS:PRINTER;DES:Hewlett-Packard DeskJet 990C;SN:US05N1J00XLG;S:00808880800010032C1000000C2000000;P:0800,FL,B0;J:                   ;'}, [...] }

For some backends that do not provide complete URIs, such as the 'smb' backend, the "New printer..." dialog will help the user to find a printer. For the 'smb' backend for example, a browser widget similar to the one used in Fedora Core 4's system-config-printer will allow the user to navigate to a particular Windows printer, and a URI will be constructed for that. For the 'lpd' backend we could have textentry widgets for 'printer' and 'queue', so that the resulting URI is lpd://printer/queue. A checkbutton could extend that to lpd://printer/queue?reserve=yes (for RFC 1179 compliance).

The user must be able to edit the URI as well.

There are some special cases for which backend to use. A given printer may appear as a complete URI from several different backends at once. For example, an HP printer could be found by the HPLIP 'hp' backend, the CUPS 'usb' backend, and from the 'hal' backend (which delegates to the 'usb' backend I think).

If the HPLIP 'hp' backend can detect the printer, that backend should be used for it in preference to 'usb' or 'hal'. This is so that multi-function devices can have their other functions used as well. HPLIP provides scanning and faxing functionality in addition to printing.

The printer model
Once a device URI has been created, we need to know what PPD to use to drive the printer. For this we need the IEEE 1284 Device ID, if we can get hold of it. For 'usb', 'hp', and 'hal' backends, this should be provided in the 'device-id' attribute we got from cups.Connection.getDevices [note: only 'usb' works right now]. For 'socket' (Jet Script or PXL printers, but if the user has the manufacturer's PPD then that should be used in preference, so we need to ask them if they have that.

Otherwise, we're stuck, and we have to ask the user to tell us what printer model they have.


 * They can select from the list of printers in the foomatic database


 * They can select from the list of CUPS PPDs; i.e. what you get from cups.Connection.getPPDs


 * Or, as a last resort, we can ask them to just give us a PPD.

The printer driver, if there is more than one possibility
If the user selected from the list of foomatic printers, and there is no recommended driver but several available drivers, we can either just pick one arbitrarily, or offer the user the choice. (Alternatively, of course, I can change foomatic so that there is always a recommended driver, even if it is arbitrary.)