- Handle icon load failure gracefully.
This commit is contained in:
parent
a9d6dbac1e
commit
34b42fa4d8
93
system-config-printer-icon-load-traceback.patch
Normal file
93
system-config-printer-icon-load-traceback.patch
Normal file
@ -0,0 +1,93 @@
|
||||
diff -up system-config-printer-1.1.12/jobviewer.py.icon-load-traceback system-config-printer-1.1.12/jobviewer.py
|
||||
--- system-config-printer-1.1.12/jobviewer.py.icon-load-traceback 2009-08-25 17:01:27.000000000 +0100
|
||||
+++ system-config-printer-1.1.12/jobviewer.py 2009-08-26 17:46:06.744314174 +0100
|
||||
@@ -1033,18 +1033,20 @@ class JobViewer (GtkGUI, monitor.Watcher
|
||||
# Add an emblem to the icon.
|
||||
icon = StateReason.LEVEL_ICON[level]
|
||||
pixbuf = pixbuf.copy ()
|
||||
- theme = gtk.icon_theme_get_default ()
|
||||
-
|
||||
- emblem = theme.load_icon (icon, 22, 0)
|
||||
- emblem.composite (pixbuf,
|
||||
- pixbuf.get_width () / 2,
|
||||
- pixbuf.get_height () / 2,
|
||||
- emblem.get_width () / 2,
|
||||
- emblem.get_height () / 2,
|
||||
- pixbuf.get_width () / 2,
|
||||
- pixbuf.get_height () / 2,
|
||||
- 0.5, 0.5,
|
||||
- gtk.gdk.INTERP_BILINEAR, 255)
|
||||
+ try:
|
||||
+ theme = gtk.icon_theme_get_default ()
|
||||
+ emblem = theme.load_icon (icon, 22, 0)
|
||||
+ emblem.composite (pixbuf,
|
||||
+ pixbuf.get_width () / 2,
|
||||
+ pixbuf.get_height () / 2,
|
||||
+ emblem.get_width () / 2,
|
||||
+ emblem.get_height () / 2,
|
||||
+ pixbuf.get_width () / 2,
|
||||
+ pixbuf.get_height () / 2,
|
||||
+ 0.5, 0.5,
|
||||
+ gtk.gdk.INTERP_BILINEAR, 255)
|
||||
+ except gobject.GError:
|
||||
+ debugprint ("No %s icon available" % icon)
|
||||
|
||||
return pixbuf
|
||||
|
||||
diff -up system-config-printer-1.1.12/system-config-printer.py.icon-load-traceback system-config-printer-1.1.12/system-config-printer.py
|
||||
--- system-config-printer-1.1.12/system-config-printer.py.icon-load-traceback 2009-08-26 17:45:45.471190754 +0100
|
||||
+++ system-config-printer-1.1.12/system-config-printer.py 2009-08-26 17:46:06.753314108 +0100
|
||||
@@ -1469,28 +1469,34 @@ class GUI(GtkGUI, monitor.Watcher):
|
||||
|
||||
if def_emblem:
|
||||
(w, h) = gtk.icon_size_lookup (gtk.ICON_SIZE_DIALOG)
|
||||
- default_emblem = theme.load_icon (def_emblem, w/2, 0)
|
||||
- copy = pixbuf.copy ()
|
||||
- default_emblem.composite (copy, 0, 0,
|
||||
- copy.get_width (),
|
||||
- copy.get_height (),
|
||||
- 0, 0,
|
||||
- 1.0, 1.0,
|
||||
- gtk.gdk.INTERP_NEAREST, 255)
|
||||
- pixbuf = copy
|
||||
+ try:
|
||||
+ default_emblem = theme.load_icon (def_emblem, w/2, 0)
|
||||
+ copy = pixbuf.copy ()
|
||||
+ default_emblem.composite (copy, 0, 0,
|
||||
+ copy.get_width (),
|
||||
+ copy.get_height (),
|
||||
+ 0, 0,
|
||||
+ 1.0, 1.0,
|
||||
+ gtk.gdk.INTERP_NEAREST, 255)
|
||||
+ pixbuf = copy
|
||||
+ except gobject.GError:
|
||||
+ debugprint ("No %s icon available" % def_emblem)
|
||||
|
||||
if emblem:
|
||||
(w, h) = gtk.icon_size_lookup (gtk.ICON_SIZE_DIALOG)
|
||||
- other_emblem = theme.load_icon (emblem, w/2, 0)
|
||||
- copy = pixbuf.copy ()
|
||||
- other_emblem.composite (copy, 0, 0,
|
||||
- copy.get_width (),
|
||||
- copy.get_height (),
|
||||
- copy.get_width () / 2,
|
||||
- copy.get_height () / 2,
|
||||
- 1.0, 1.0,
|
||||
- gtk.gdk.INTERP_NEAREST, 255)
|
||||
- pixbuf = copy
|
||||
+ try:
|
||||
+ other_emblem = theme.load_icon (emblem, w/2, 0)
|
||||
+ copy = pixbuf.copy ()
|
||||
+ other_emblem.composite (copy, 0, 0,
|
||||
+ copy.get_width (),
|
||||
+ copy.get_height (),
|
||||
+ copy.get_width () / 2,
|
||||
+ copy.get_height () / 2,
|
||||
+ 1.0, 1.0,
|
||||
+ gtk.gdk.INTERP_NEAREST, 255)
|
||||
+ pixbuf = copy
|
||||
+ except gobject.GError:
|
||||
+ debugprint ("No %s icon available" % emblem)
|
||||
|
||||
self.mainlist.append (row=[object, pixbuf, name, tip])
|
||||
|
@ -16,6 +16,7 @@ Source1: http://cyberelk.net/tim/data/pycups/pycups-%{pycups_version}.tar.bz2
|
||||
Source2: http://cyberelk.net/tim/data/pysmbc/pysmbc-%{pysmbc_version}.tar.bz2
|
||||
Patch1: system-config-printer-get_cursor.patch
|
||||
Patch2: system-config-printer-statereason-icons.patch
|
||||
Patch3: system-config-printer-icon-load-traceback.patch
|
||||
|
||||
BuildRequires: cups-devel >= 1.2
|
||||
BuildRequires: python-devel >= 2.4
|
||||
@ -78,6 +79,7 @@ printers.
|
||||
%setup -q -a 1 -a 2
|
||||
%patch1 -p1 -b .get_cursor
|
||||
%patch2 -p1 -b .statereason-icons
|
||||
%patch3 -p1 -b .icon-load-traceback
|
||||
|
||||
%build
|
||||
%configure --with-udev-rules
|
||||
@ -190,6 +192,7 @@ exit 0
|
||||
|
||||
%changelog
|
||||
* Wed Aug 26 2009 Tim Waugh <twaugh@redhat.com> 1.1.12-3
|
||||
- Handle icon load failure gracefully.
|
||||
- Fixed statereason icon names.
|
||||
|
||||
* Wed Aug 26 2009 Tim Waugh <twaugh@redhat.com> 1.1.12-2
|
||||
|
Loading…
Reference in New Issue
Block a user