From e4712e86bcad30f13881a9ab57f0bb9d4f855cc4 Mon Sep 17 00:00:00 2001 From: Tim Waugh Date: Wed, 6 Jan 2010 15:54:23 +0000 Subject: [PATCH] - Make sure there are enough ink level values (bug #541882). --- system-config-printer-ink-levels.patch | 31 ++++++++++++++++++++++++++ system-config-printer.spec | 3 +++ 2 files changed, 34 insertions(+) create mode 100644 system-config-printer-ink-levels.patch diff --git a/system-config-printer-ink-levels.patch b/system-config-printer-ink-levels.patch new file mode 100644 index 0000000..64116d6 --- /dev/null +++ b/system-config-printer-ink-levels.patch @@ -0,0 +1,31 @@ +diff -up system-config-printer-1.1.16/system-config-printer.py.ink-levels system-config-printer-1.1.16/system-config-printer.py +--- system-config-printer-1.1.16/system-config-printer.py.ink-levels 2010-01-06 15:49:08.433408576 +0000 ++++ system-config-printer-1.1.16/system-config-printer.py 2010-01-06 15:50:54.892284445 +0000 +@@ -2505,6 +2505,7 @@ class GUI(GtkGUI, monitor.Watcher): + self.vboxMarkerLevels.remove (widget) + + marker_info = dict() ++ num_markers = 0 + for (attr, typ) in [('marker-colors', str), + ('marker-names', str), + ('marker-types', str), +@@ -2521,10 +2522,18 @@ class GUI(GtkGUI, monitor.Watcher): + except TypeError, s: + debugprint ("%s value not coercible to %s: %s" % + (attr, typ, s)) +- val = [] ++ val = map (lambda x: 0.0, val) + + marker_info[attr] = val ++ if num_markers == 0 or len (val) < num_markers: ++ num_markers = len (val) + ++ for attr in ['marker-colors', 'marker-names', ++ 'marker-types', 'marker-levels']: ++ if len (marker_info[attr]) > num_markers: ++ debugprint ("Trimming %s from %s" % ++ (marker_info[attr][num_markers:], attr)) ++ del marker_info[attr][num_markers:] + + markers = map (lambda color, name, type, level: + (color, name, type, level), diff --git a/system-config-printer.spec b/system-config-printer.spec index 3a1c045..2d303fd 100644 --- a/system-config-printer.spec +++ b/system-config-printer.spec @@ -23,6 +23,7 @@ Patch5: system-config-printer-jobviewer-exit.patch Patch6: system-config-printer-npinit-traceback.patch Patch7: system-config-printer-notification-timeouts.patch Patch8: system-config-printer-select-nonexistent-printer.patch +Patch9: system-config-printer-ink-levels.patch BuildRequires: cups-devel >= 1.2 BuildRequires: python-devel >= 2.4 @@ -90,6 +91,7 @@ printers. %patch6 -p1 -b .npinit-traceback %patch7 -p1 -b .notification-timeouts %patch8 -p1 -b .select-nonexistent-printer +%patch9 -p1 -b .ink-levels %build %configure --with-udev-rules --with-polkit-1 @@ -207,6 +209,7 @@ exit 0 %changelog * Wed Jan 6 2010 Tim Waugh - 1.1.16-3 +- Make sure there are enough ink level values (bug #541882). - Make sure the printer we added still exists before selecting it (bug #551436). - Set notification timeouts appropriately (bug #550829).