Package: system-config-printer / 1.5.11-4

0006-use-paper-size-default-in-etc-papersize.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
From: Till Kamppeter <till.kamppeter@gmail.com>
Date: Fri, 29 Oct 2010 12:53:06 +0200
Subject: Use setting in /etc/papersize if available

Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=593219
Origin: vendor
---
 cupshelpers/cupshelpers.py | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/cupshelpers/cupshelpers.py b/cupshelpers/cupshelpers.py
index 978ab80..7214465 100755
--- a/cupshelpers/cupshelpers.py
+++ b/cupshelpers/cupshelpers.py
@@ -740,6 +740,23 @@ def setPPDPageSize(ppd, language):
     for each in letter:
         if language == each:
             size = 'Letter'
+
+    # Use setting in /etc/papersize if available
+    try:
+        f = open ("/etc/papersize")
+        for line in f:
+            if line.startswith("#"):
+                continue
+            if line.strip().lower().startswith("a4"):
+                size = 'A4'
+            elif line.strip().lower().startswith("letter"):
+                size = 'Letter'
+            elif line.strip() != "":
+                break
+        f.close()
+    except:
+        pass
+
     try:
         ppd.markOption ('PageSize', size)
         _debugprint ("set PageSize = %s" % size)