| 1 |
From: Till Kamppeter <[email protected]> |
| 2 |
Date: Fri, 29 Oct 2010 12:53:06 +0200 |
| 3 |
Subject: Use setting in /etc/papersize if available |
| 4 |
|
| 5 |
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=593219 |
| 6 |
Origin: vendor |
| 7 |
--- |
| 8 |
cupshelpers/cupshelpers.py | 17 +++++++++++++++++ |
| 9 |
1 file changed, 17 insertions(+) |
| 10 |
|
| 11 |
diff --git a/cupshelpers/cupshelpers.py b/cupshelpers/cupshelpers.py |
| 12 |
index 8fe7ead..b2907b6 100755 |
| 13 |
--- a/cupshelpers/cupshelpers.py |
| 14 |
+++ b/cupshelpers/cupshelpers.py |
| 15 |
@@ -740,6 +740,23 @@ def setPPDPageSize(ppd, language): |
| 16 |
for each in letter: |
| 17 |
if language == each: |
| 18 |
size = 'Letter' |
| 19 |
+ |
| 20 |
+ # Use setting in /etc/papersize if available |
| 21 |
+ try: |
| 22 |
+ f = open ("/etc/papersize") |
| 23 |
+ for line in f: |
| 24 |
+ if line.startswith("#"): |
| 25 |
+ continue |
| 26 |
+ if line.strip().lower().startswith("a4"): |
| 27 |
+ size = 'A4' |
| 28 |
+ elif line.strip().lower().startswith("letter"): |
| 29 |
+ size = 'Letter' |
| 30 |
+ elif line.strip() != "": |
| 31 |
+ break |
| 32 |
+ f.close() |
| 33 |
+ except: |
| 34 |
+ pass |
| 35 |
+ |
| 36 |
try: |
| 37 |
ppd.markOption ('PageSize', size) |
| 38 |
_debugprint ("set PageSize = %s" % size) |