From ea8cd59b828e931da4770450ed8bbbeeece43910 Mon Sep 17 00:00:00 2001 From: Tim Waugh Date: Wed, 11 Nov 2009 15:03:51 +0000 Subject: [PATCH] - Suggest installing foomatic-db-ppds when appropriate (bug #536831). --- ...fig-printer-install-foomatic-db-ppds.patch | 56 +++++++++++++++++++ system-config-printer.spec | 7 ++- 2 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 system-config-printer-install-foomatic-db-ppds.patch diff --git a/system-config-printer-install-foomatic-db-ppds.patch b/system-config-printer-install-foomatic-db-ppds.patch new file mode 100644 index 0000000..96af7e8 --- /dev/null +++ b/system-config-printer-install-foomatic-db-ppds.patch @@ -0,0 +1,56 @@ +diff -up system-config-printer-1.1.13/cupshelpers/cupshelpers.py.install-foomatic-db-ppds system-config-printer-1.1.13/cupshelpers/cupshelpers.py +--- system-config-printer-1.1.13/cupshelpers/cupshelpers.py.install-foomatic-db-ppds 2009-09-04 10:34:16.000000000 +0100 ++++ system-config-printer-1.1.13/cupshelpers/cupshelpers.py 2009-11-11 14:50:51.557767784 +0000 +@@ -473,7 +473,10 @@ def parseDeviceID (id): + id_dict.setdefault("CMD", id_dict["COMMAND SET"]) + for name in ["MFG", "MDL", "CMD", "CLS", "DES", "SN", "S", "P", "J"]: + id_dict.setdefault(name, "") +- id_dict["CMD"] = id_dict["CMD"].split(',') ++ if id_dict["CMD"] == '': ++ id_dict["CMD"] = [] ++ else: ++ id_dict["CMD"] = id_dict["CMD"].split(',') + return id_dict + + class Device: +diff -up system-config-printer-1.1.13/system-config-printer.py.install-foomatic-db-ppds system-config-printer-1.1.13/system-config-printer.py +--- system-config-printer-1.1.13/system-config-printer.py.install-foomatic-db-ppds 2009-11-11 14:50:33.835893883 +0000 ++++ system-config-printer-1.1.13/system-config-printer.py 2009-11-11 14:50:51.560768061 +0000 +@@ -4293,6 +4293,37 @@ class NewPrinterGUI(GtkGUI): + except: + nonfatalException () + ++ # Decide whether this might be a PostScript capable ++ # printer. If it might be, check whether ++ # foomatic-db-ppds is installed and suggest installing ++ # it. ++ cmdsets = self.device.id_dict["CMD"] ++ if len (cmdsets) == 0: ++ # No list of command sets available so might be PS capable ++ may_be_ps = True ++ else: ++ # We have the definitive list of command sets supported. ++ # Only PS capable if it says so. ++ may_be_ps = False ++ for cmdset in cmdsets: ++ if cmdset.lower ().startswith ("postscript"): ++ may_be_ps = True ++ ++ if may_be_ps: ++ debugprint ("Printer might support PostScript") ++ try: ++ os.stat ("/usr/share/cups/model/foomatic-db-ppds") ++ debugprint ("foomatic-db-ppds already installed") ++ except OSError: ++ debugprint ("foomatic-db-ppds not yet installed") ++ pk = installpackage.PackageKit () ++ pid = None ++ try: ++ xid = self.mainapp.PrintersWindow.window.xid ++ pk.InstallPackageName (xid, 0, "foomatic-db-ppds") ++ except: ++ pass ++ + if (not self.remotecupsqueue and + not self.new_printer_PPDs_loaded): + try: diff --git a/system-config-printer.spec b/system-config-printer.spec index 69883cd..985c444 100644 --- a/system-config-printer.spec +++ b/system-config-printer.spec @@ -7,7 +7,7 @@ Summary: A printer administration tool Name: system-config-printer Version: 1.1.13 -Release: 9%{?dist} +Release: 10%{?dist} License: GPLv2+ URL: http://cyberelk.net/tim/software/system-config-printer/ Group: System Environment/Base @@ -35,6 +35,7 @@ Patch17: system-config-printer-no-epydoc.patch Patch18: system-config-printer-notification-traceback.patch Patch19: system-config-printer-de.po-typo.patch Patch20: system-config-printer-test-page-traceback.patch +Patch21: system-config-printer-install-foomatic-db-ppds.patch BuildRequires: cups-devel >= 1.2 BuildRequires: python-devel >= 2.4 @@ -114,6 +115,7 @@ printers. %patch18 -p1 -b .notification-traceback %patch19 -p1 -b .de.po-typo %patch20 -p1 -b .test-page-traceback +%patch21 -p1 -b .install-foomatic-db-ppds %build %configure --with-udev-rules --with-polkit-1 @@ -225,6 +227,9 @@ rm -rf %buildroot exit 0 %changelog +* Wed Nov 11 2009 Tim Waugh 1.1.13-10 +- Suggest installing foomatic-db-ppds when appropriate (bug #536831). + * Thu Nov 5 2009 Tim Waugh 1.1.13-9 - Release bump.