- Prefer foomatic-recommended drivers (bug #550108).

This commit is contained in:
Tim Waugh 2009-12-23 16:17:13 +00:00
parent 60072c85c7
commit d2ccf03fa0
2 changed files with 40 additions and 0 deletions

View File

@ -0,0 +1,37 @@
diff -up system-config-printer-1.1.16/cupshelpers/ppds.py.foomatic-recommended system-config-printer-1.1.16/cupshelpers/ppds.py
--- system-config-printer-1.1.16/cupshelpers/ppds.py.foomatic-recommended 2009-12-22 14:27:37.000000000 +0000
+++ system-config-printer-1.1.16/cupshelpers/ppds.py 2009-12-23 16:13:13.234214808 +0000
@@ -248,14 +248,25 @@ def _getDriverType (ppdname, ppds=None):
# Foomatic (generated) -- but which driver?
if ppdname.find ("Generic")!= -1:
return DRIVER_TYPE_FOOMATIC_GENERIC
- if (ppds != None and
- ppds.getInfoFromPPDName (ppdname).\
- get ('ppd-make-and-model', '').find ("(recommended)") != -1):
- if ppds.getInfoFromPPDName (ppdname).\
- get ('ppd-make-and-model', '').find ("Postscript") != -1:
- return DRIVER_TYPE_FOOMATIC_RECOMMENDED_POSTSCRIPT
- else:
- return DRIVER_TYPE_FOOMATIC_RECOMMENDED_NON_POSTSCRIPT
+ if ppds != None:
+ info = ppds.getInfoFromPPDName (ppdname)
+ device_id = info.get ('ppd-device-id', '')
+ id_dict = parseDeviceID (device_id)
+ drv = id_dict.get ('DRV', '')
+ drvfields = dict()
+ for field in drv.split (','):
+ if len (field) == 0:
+ continue
+ key = field[0]
+ drvfields[key] = field[1:]
+
+ ppd_make_and_model = info.get ('ppd-make-and-model', '')
+ if (drvfields.get ('R', '0') == '1' or
+ ppd_make_and_model.find ("(recommended)") != -1):
+ if ppd_make_and_model.find ("Postscript") != -1:
+ return DRIVER_TYPE_FOOMATIC_RECOMMENDED_POSTSCRIPT
+ else:
+ return DRIVER_TYPE_FOOMATIC_RECOMMENDED_NON_POSTSCRIPT
if ppdname.find ("-Postscript")!= -1:
return DRIVER_TYPE_FOOMATIC_PS
if ppdname.find ("-hpijs") != -1:

View File

@ -18,6 +18,7 @@ Source2: http://cyberelk.net/tim/data/pysmbc/pysmbc-%{pysmbc_version}.tar.bz2
Patch1: system-config-printer-no-epydoc.patch
Patch2: system-config-printer-typo.patch
Patch3: system-config-printer-driver-pre-selection.patch
Patch4: system-config-printer-foomatic-recommended.patch
BuildRequires: cups-devel >= 1.2
BuildRequires: python-devel >= 2.4
@ -80,6 +81,7 @@ printers.
%patch1 -p1 -b .no-epydoc
%patch2 -p1 -b .typo
%patch3 -p1 -b .driver-pre-selection
%patch4 -p1 -b .foomatic-recommended
%build
%configure --with-udev-rules --with-polkit-1
@ -197,6 +199,7 @@ exit 0
%changelog
* Wed Dec 23 2009 Tim Waugh <twaugh@redhat.com> - 1.1.16-2
- Prefer foomatic-recommended drivers (bug #550108).
- Pre-select correct driver when adding or changing a queue (bug #550075).
- Fixed typo (bug #550096).