system-config-printer/system-config-printer-duplicate-PPDs.patch
Jiri Popelka e1726083ab Fixed driver selection when there are duplicate PPDs available. (#667571)
Grabbing focus for editing breaks it (bug #650995).
2011-01-21 13:10:20 +01:00

57 lines
2.4 KiB
Diff

diff -up system-config-printer-1.2.96/newprinter.py.duplicate-PPDs system-config-printer-1.2.96/newprinter.py
--- system-config-printer-1.2.96/newprinter.py.duplicate-PPDs 2011-01-21 12:59:20.000000000 +0100
+++ system-config-printer-1.2.96/newprinter.py 2011-01-21 13:05:50.000000000 +0100
@@ -3024,8 +3024,10 @@ class NewPrinterGUI(GtkGUI):
self.NPDrivers = drivers
driverlist = []
- for i in range (len(self.NPDrivers)):
- ppd = self.ppds.getInfoFromPPDName (self.NPDrivers[i])
+ NPDrivers = []
+ i = 0
+ for ppdname in self.NPDrivers:
+ ppd = self.ppds.getInfoFromPPDName (ppdname)
driver = _singleton (ppd["ppd-make-and-model"])
driver = driver.replace(" (recommended)", "")
@@ -3035,18 +3037,20 @@ class NewPrinterGUI(GtkGUI):
except KeyError:
pass
- duplicate = False
- if driver in driverlist:
- duplicate = True
- else:
- driverlist.append (driver)
+ duplicate = driver in driverlist
- if not self.device and self.auto_driver == self.NPDrivers[i]:
+ if not self.device and self.auto_driver == ppdname:
+ driverlist.append (driver)
+ NPDrivers.append (ppdname)
+ i += 1
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 self.recommended_model_selected and i == 0:
+ elif self.device and i == 0:
+ driverlist.append (driver)
+ NPDrivers.append (ppdname)
+ i += 1
iter = model.append ((driver + _(" (recommended)"),))
path = model.get_path (iter)
self.tvNPDrivers.get_selection().select_path(path)
@@ -3054,7 +3058,11 @@ class NewPrinterGUI(GtkGUI):
else:
if duplicate:
continue
+ driverlist.append (driver)
+ NPDrivers.append (ppdname)
+ i += 1
model.append((driver, ))
+ self.NPDrivers = NPDrivers
self.tvNPDrivers.columns_autosize()
def on_NPDrivers_query_tooltip(self, tv, x, y, keyboard_mode, tooltip):