system-config-printer/system-config-printer-install-foomatic-db-ppds.patch

57 lines
2.9 KiB
Diff
Raw Normal View History

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: