2009-12-23 15:04:43 +00:00
|
|
|
diff -up system-config-printer-1.1.16/system-config-printer.py.driver-pre-selection system-config-printer-1.1.16/system-config-printer.py
|
2010-01-11 15:52:04 +00:00
|
|
|
--- system-config-printer-1.1.16/system-config-printer.py.driver-pre-selection 2010-01-11 14:58:14.392910996 +0000
|
|
|
|
+++ system-config-printer-1.1.16/system-config-printer.py 2010-01-11 14:58:23.834909684 +0000
|
|
|
|
@@ -3913,6 +3913,7 @@ class NewPrinterGUI(GtkGUI):
|
|
|
|
self.rbtnChangePPDKeepSettings.set_active(True)
|
|
|
|
|
|
|
|
self.auto_model = ""
|
|
|
|
+ self.auto_driver = None
|
|
|
|
ppd = self.mainapp.ppd
|
|
|
|
#self.mainapp.devid = "MFG:Samsung;MDL:ML-3560;DES:;CMD:GDI;"
|
|
|
|
devid = self.mainapp.devid
|
|
|
|
@@ -3968,38 +3969,41 @@ class NewPrinterGUI(GtkGUI):
|
2009-12-23 15:04:43 +00:00
|
|
|
else:
|
|
|
|
self.auto_make = devid_dict["MFG"]
|
|
|
|
self.auto_model = devid_dict["MDL"]
|
|
|
|
+ self.auto_driver = None
|
|
|
|
except:
|
|
|
|
self.auto_make = devid_dict["MFG"]
|
|
|
|
self.auto_model = devid_dict["MDL"]
|
|
|
|
+ self.auto_driver = None
|
|
|
|
if not self.device or not self.device.id:
|
|
|
|
self.device.id = devid
|
|
|
|
self.device.id_dict = cupshelpers.parseDeviceID (devid)
|
|
|
|
self.mainapp.devid = ""
|
|
|
|
elif ppd:
|
|
|
|
- attr = ppd.findAttr("Manufacturer")
|
|
|
|
- if attr:
|
|
|
|
- mfr = attr.value
|
2010-01-11 15:52:04 +00:00
|
|
|
- else:
|
2009-12-23 15:04:43 +00:00
|
|
|
- mfr = ""
|
|
|
|
- makeandmodel = mfr
|
|
|
|
- attr = ppd.findAttr("ModelName")
|
|
|
|
- if not attr: attr = ppd.findAttr("ShortNickName")
|
|
|
|
- if not attr: attr = ppd.findAttr("NickName")
|
|
|
|
- if attr:
|
|
|
|
- if attr.value.startswith(mfr):
|
|
|
|
- makeandmodel = attr.value
|
|
|
|
- else:
|
|
|
|
- makeandmodel += ' ' + attr.value
|
|
|
|
- else:
|
|
|
|
- makeandmodel = ''
|
2010-01-11 15:52:04 +00:00
|
|
|
+ attr = ppd.findAttr("NickName")
|
|
|
|
+ if not attr:
|
|
|
|
+ attr = ppd.findAttr("ModelName")
|
|
|
|
+
|
|
|
|
+ if attr.value:
|
|
|
|
+ mfgmdl = cupshelpers.ppds.ppdMakeModelSplit (attr.value)
|
|
|
|
+ (self.auto_make, self.auto_model) = mfgmdl
|
|
|
|
|
2009-12-23 15:04:43 +00:00
|
|
|
- (self.auto_make,
|
|
|
|
- self.auto_model) = \
|
|
|
|
- cupshelpers.ppds.ppdMakeModelSplit (makeandmodel)
|
2010-01-11 15:52:04 +00:00
|
|
|
+ # Search for ppdname with that make-and-model
|
|
|
|
+ self.loadPPDs ()
|
|
|
|
+ ppds = self.ppds.getInfoFromModel (self.auto_make,
|
|
|
|
+ self.auto_model)
|
|
|
|
+ for ppd, info in ppds.iteritems ():
|
|
|
|
+ if info.get ("ppd-make-and-model") == attr.value:
|
|
|
|
+ self.auto_driver = ppd
|
|
|
|
+ break
|
|
|
|
+ else:
|
2009-12-23 15:04:43 +00:00
|
|
|
+ self.auto_make = None
|
|
|
|
+ self.auto_model = None
|
|
|
|
+ self.auto_driver = None
|
|
|
|
else:
|
|
|
|
# Special CUPS names for a raw queue.
|
|
|
|
self.auto_make = 'Generic'
|
|
|
|
self.auto_model = 'Raw Queue'
|
|
|
|
+ self.auto_driver = None
|
|
|
|
|
|
|
|
try:
|
|
|
|
if self.dialog_mode == "ppd":
|
2010-01-11 15:52:04 +00:00
|
|
|
@@ -4249,6 +4253,8 @@ class NewPrinterGUI(GtkGUI):
|
2009-12-23 15:04:43 +00:00
|
|
|
if self.openprinting_query_handle != None:
|
|
|
|
self.openprinting.cancelOperation (self.openprinting_query_handle)
|
|
|
|
self.openprinting_query_handle = None
|
|
|
|
+
|
|
|
|
+ self.device = None
|
|
|
|
return True
|
|
|
|
|
|
|
|
def on_btnNPBack_clicked(self, widget):
|
2010-01-11 15:52:04 +00:00
|
|
|
@@ -4267,6 +4273,7 @@ class NewPrinterGUI(GtkGUI):
|
2009-12-23 15:04:43 +00:00
|
|
|
self.busy (self.NewPrinterWindow)
|
|
|
|
if page_nr == 1: # Device (first page)
|
|
|
|
self.auto_make, self.auto_model = None, None
|
|
|
|
+ self.auto_driver = None
|
|
|
|
self.device.uri = self.getDeviceURI()
|
|
|
|
if not self.install_hplip_plugin(self.device.uri):
|
|
|
|
self.on_NPCancel(None)
|
2010-01-11 15:52:04 +00:00
|
|
|
@@ -4434,6 +4441,7 @@ class NewPrinterGUI(GtkGUI):
|
2009-12-23 15:04:43 +00:00
|
|
|
cupshelpers.ppds.ppdMakeModelSplit (make_model)
|
|
|
|
self.auto_make = make
|
|
|
|
self.auto_model = model
|
|
|
|
+ self.auto_driver = ppdname
|
|
|
|
if (status == self.ppds.STATUS_SUCCESS and \
|
|
|
|
self.dialog_mode != "ppd"):
|
|
|
|
self.exactdrivermatch = True
|
2010-01-11 15:52:04 +00:00
|
|
|
@@ -6414,7 +6422,17 @@ class NewPrinterGUI(GtkGUI):
|
2009-12-23 15:04:43 +00:00
|
|
|
ppds = self.ppds.getInfoFromModel(pmake, pmodel)
|
|
|
|
|
|
|
|
self.NPDrivers = self.ppds.orderPPDNamesByPreference(ppds.keys(),
|
|
|
|
- self.jockey_installed_files)
|
|
|
|
+ self.jockey_installed_files)
|
|
|
|
+ if self.auto_driver and self.device:
|
|
|
|
+ drivers = []
|
|
|
|
+ for driver in self.NPDrivers:
|
|
|
|
+ if driver == self.auto_driver:
|
|
|
|
+ drivers.insert (0, driver)
|
|
|
|
+ else:
|
|
|
|
+ drivers.append (driver)
|
|
|
|
+
|
|
|
|
+ self.NPDrivers = drivers
|
|
|
|
+
|
|
|
|
for i in range (len(self.NPDrivers)):
|
|
|
|
ppd = ppds[self.NPDrivers[i]]
|
|
|
|
driver = ppd["ppd-make-and-model"]
|
2010-01-11 15:52:04 +00:00
|
|
|
@@ -6426,7 +6444,12 @@ class NewPrinterGUI(GtkGUI):
|
2009-12-23 15:04:43 +00:00
|
|
|
except KeyError:
|
|
|
|
pass
|
|
|
|
|
|
|
|
- if i == 0:
|
|
|
|
+ if not self.device and self.auto_driver == self.NPDrivers[i]:
|
|
|
|
+ iter = model.append ((driver + _(" (Current)"),))
|
|
|
|
+ path = model.get_path (iter)
|
|
|
|
+ self.tvNPDrivers.get_selection().select_path(path)
|
|
|
|
+ self.tvNPDrivers.scroll_to_cell(path, None, True, 0.5, 0.0)
|
|
|
|
+ elif self.device and i == 0:
|
|
|
|
iter = model.append ((driver + _(" (recommended)"),))
|
|
|
|
path = model.get_path (iter)
|
|
|
|
self.tvNPDrivers.get_selection().select_path(path)
|
2010-01-11 15:52:04 +00:00
|
|
|
@@ -6881,6 +6904,7 @@ class NewPrinterGUI(GtkGUI):
|
2009-12-23 15:04:43 +00:00
|
|
|
checkppd = ppd
|
|
|
|
|
|
|
|
self.NewPrinterWindow.hide()
|
|
|
|
+ self.device = None
|
|
|
|
self.mainapp.populateList()
|
|
|
|
|
|
|
|
# Now select it.
|