- Clean up temporary files when localizing statereason (bug #552768).
This commit is contained in:
parent
22080998fa
commit
1c56788446
2
clog1
2
clog1
@ -1,2 +1,2 @@
|
|||||||
* Mon Jan 18 2010 Tim Waugh <twaugh@redhat.com> - 1.1.16-9
|
* Mon Jan 18 2010 Tim Waugh <twaugh@redhat.com> - 1.1.16-9
|
||||||
- Make sure serial device widgets are always initialized (bug #556488).
|
- Clean up temporary files when localizing statereason (bug #552768).
|
||||||
|
75
system-config-printer-statereason-tmp.patch
Normal file
75
system-config-printer-statereason-tmp.patch
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
diff -up system-config-printer-1.1.16/statereason.py.statereason-tmp system-config-printer-1.1.16/statereason.py
|
||||||
|
--- system-config-printer-1.1.16/statereason.py.statereason-tmp 2009-12-22 14:44:19.000000000 +0000
|
||||||
|
+++ system-config-printer-1.1.16/statereason.py 2010-01-18 17:24:22.301560654 +0000
|
||||||
|
@@ -1,7 +1,9 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
-## Copyright (C) 2007, 2008, 2009 Tim Waugh <twaugh@redhat.com>
|
||||||
|
-## Copyright (C) 2007, 2008, 2009 Red Hat, Inc.
|
||||||
|
+## Copyright (C) 2007, 2008, 2009, 2010 Red Hat, Inc.
|
||||||
|
+## Authors:
|
||||||
|
+## Tim Waugh <twaugh@redhat.com>
|
||||||
|
+## Jiri Popelka <jpopelka@redhat.com>
|
||||||
|
|
||||||
|
## This program is free software; you can redistribute it and/or modify
|
||||||
|
## it under the terms of the GNU General Public License as published by
|
||||||
|
@@ -18,6 +20,7 @@
|
||||||
|
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
|
||||||
|
import cups
|
||||||
|
+import os
|
||||||
|
|
||||||
|
_ = lambda x: x
|
||||||
|
def set_gettext_function (fn):
|
||||||
|
@@ -41,6 +44,7 @@ class StateReason:
|
||||||
|
self.level = None
|
||||||
|
self.canonical_reason = None
|
||||||
|
self.connection = connection
|
||||||
|
+ self._ppd = None
|
||||||
|
|
||||||
|
def get_printer (self):
|
||||||
|
return self.printer
|
||||||
|
@@ -125,21 +129,29 @@ class StateReason:
|
||||||
|
elif self.get_level () == self.ERROR:
|
||||||
|
title = _("Printer error")
|
||||||
|
|
||||||
|
- try:
|
||||||
|
- f = self.connection.getPPD(self.printer)
|
||||||
|
- ppd = cups.PPD (f)
|
||||||
|
- schemes = ["text", "http", "help", "file"]
|
||||||
|
- localized_reason = ""
|
||||||
|
- for scheme in schemes:
|
||||||
|
- reason = ppd.localizeIPPReason(self.reason, scheme)
|
||||||
|
- if reason != None:
|
||||||
|
- localized_reason = localized_reason + reason + ", "
|
||||||
|
- if localized_reason != "":
|
||||||
|
- reason = localized_reason[:-2]
|
||||||
|
- else:
|
||||||
|
+ if not self._ppd:
|
||||||
|
+ try:
|
||||||
|
+ f = self.connection.getPPD(self.printer)
|
||||||
|
+ self._ppd = cups.PPD (f)
|
||||||
|
+ os.unlink (f)
|
||||||
|
+ except (cups.IPPError, OSError):
|
||||||
|
+ pass
|
||||||
|
+
|
||||||
|
+ if self._ppd:
|
||||||
|
+ try:
|
||||||
|
+ schemes = ["text", "http", "help", "file"]
|
||||||
|
+ localized_reason = ""
|
||||||
|
+ for scheme in schemes:
|
||||||
|
+ reason = self._ppd.localizeIPPReason(self.reason,
|
||||||
|
+ scheme)
|
||||||
|
+ if reason != None:
|
||||||
|
+ localized_reason = localized_reason + reason + ", "
|
||||||
|
+ if localized_reason != "":
|
||||||
|
+ reason = localized_reason[:-2]
|
||||||
|
+ else:
|
||||||
|
+ reason = self.get_reason()
|
||||||
|
+ except RuntimeError:
|
||||||
|
reason = self.get_reason()
|
||||||
|
- except (cups.IPPError, RuntimeError):
|
||||||
|
- reason = self.get_reason()
|
||||||
|
|
||||||
|
text = _("Printer '%s': '%s'.") % (self.get_printer (), reason)
|
||||||
|
return (title, text)
|
@ -30,6 +30,7 @@ Patch12: system-config-printer-check-still-connecting.patch
|
|||||||
Patch13: system-config-printer-async-fallback.patch
|
Patch13: system-config-printer-async-fallback.patch
|
||||||
Patch14: system-config-printer-userdefault-traceback.patch
|
Patch14: system-config-printer-userdefault-traceback.patch
|
||||||
Patch15: system-config-printer-serial-widgets.patch
|
Patch15: system-config-printer-serial-widgets.patch
|
||||||
|
Patch16: system-config-printer-statereason-tmp.patch
|
||||||
|
|
||||||
Patch101: pycups-request-readio.patch
|
Patch101: pycups-request-readio.patch
|
||||||
|
|
||||||
@ -106,6 +107,7 @@ printers.
|
|||||||
%patch13 -p1 -b .async-fallback
|
%patch13 -p1 -b .async-fallback
|
||||||
%patch14 -p1 -b .userdefault-traceback
|
%patch14 -p1 -b .userdefault-traceback
|
||||||
%patch15 -p1 -b .serial-widgets
|
%patch15 -p1 -b .serial-widgets
|
||||||
|
%patch16 -p1 -b .statereason-tmp
|
||||||
|
|
||||||
pushd pycups-%{pycups_version}
|
pushd pycups-%{pycups_version}
|
||||||
%patch101 -p1 -b .request-readio
|
%patch101 -p1 -b .request-readio
|
||||||
@ -227,6 +229,7 @@ exit 0
|
|||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* Mon Jan 18 2010 Tim Waugh <twaugh@redhat.com> - 1.1.16-9
|
* Mon Jan 18 2010 Tim Waugh <twaugh@redhat.com> - 1.1.16-9
|
||||||
|
- Clean up temporary files when localizing statereason (bug #552768).
|
||||||
- Make sure serial device widgets are always initialized (bug #556488).
|
- Make sure serial device widgets are always initialized (bug #556488).
|
||||||
- Handle errors more gracefully in userdefault.py (bug #556345).
|
- Handle errors more gracefully in userdefault.py (bug #556345).
|
||||||
- Don't rely on cups-pk-helper being around (bug #556170).
|
- Don't rely on cups-pk-helper being around (bug #556170).
|
||||||
|
Loading…
Reference in New Issue
Block a user