Last-Update: 2012-08-09
Author: Dmitry Smirnov <[email protected]>
Forwarded: 2012-08-10
Description: fix svgz applications' icons.
Done by trying to load svgz images with python-rsvg first.
Helps to avoid the following run-time errors:
[EE] 2012/09/08 23:34:28 icon_util.load_pixmap_file(/usr/share/icons/mono/scalable/apps/abiword.svgz,48)
[ee] 2012/09/08 23:34:28 Traceback (most recent call last):
[ee] 2012/09/08 23:34:28 File "/usr/lib/python2.7/dist-packages/winswitch/util/icon_util.py", line 71, in load_pixmap_file
[ee] 2012/09/08 23:34:28 data = gtk_load_scaled_pixmap(filename, size_limit)
[ee] 2012/09/08 23:34:28 File "/usr/lib/python2.7/dist-packages/winswitch/util/icon_util.py", line 38, in gtk_load_scaled_pixmap
[ee] 2012/09/08 23:34:28 pixbuf = gtk.gdk.pixbuf_new_from_file(filename)
[ee] 2012/09/08 23:34:28 GError: Couldn't recognize the image file format for file '/usr/share/icons/mono/scalable/apps/abiword.svgz'
[EE] 2012/09/08 23:34:30 icon_util.load_pixmap_file(/usr/share/icons/mono/scalable/apps/synaptic.svgz,48)
[ee] 2012/09/08 23:34:30 Traceback (most recent call last):
[ee] 2012/09/08 23:34:30 File "/usr/lib/python2.7/dist-packages/winswitch/util/icon_util.py", line 71, in load_pixmap_file
[ee] 2012/09/08 23:34:30 data = gtk_load_scaled_pixmap(filename, size_limit)
[ee] 2012/09/08 23:34:30 File "/usr/lib/python2.7/dist-packages/winswitch/util/icon_util.py", line 38, in gtk_load_scaled_pixmap
[ee] 2012/09/08 23:34:30 pixbuf = gtk.gdk.pixbuf_new_from_file(filename)
[ee] 2012/09/08 23:34:30 GError: Couldn't recognize the image file format for file '/usr/share/icons/mono/scalable/apps/synaptic.svgz'
a
|
b
|
|
67 | 67 | logger.sdebug("file does not exist", filename, size_limit) |
68 | 68 | return None |
69 | 69 | try: |
| 70 | if filename.lower().endswith("svg") or filename.lower().endswith("svgz"): |
| 71 | return cairo_load_svg(filename, size_limit) |
70 | 72 | if has_gtk: |
71 | 73 | data = gtk_load_scaled_pixmap(filename, size_limit) |
72 | 74 | if data: |
73 | 75 | return data |
74 | 76 | logger.sdebug("gtk pixmap load failed", filename, size_limit) |
75 | | if filename.lower().endswith("svg") or filename.lower().endswith("svgz"): |
76 | | return cairo_load_svg(filename, size_limit) |
77 | 77 | return pil_load_scaled_pixmap(filename, size_limit) |
78 | 78 | except ValueError, e: |
79 | 79 | if (filename.lower().endswith("xpm")): |
… |
… |
|
88 | 88 | logger.serr(None, e, filename, size_limit) |
89 | 89 | return None |
90 | 90 | |
91 | | # needs gnome-python2-rsvg aka ... |
| 91 | # needs gnome-python2-rsvg aka python-rsvg |
92 | 92 | # This code was found here: |
93 | 93 | # http://mail.python.org/pipermail/python-list/2009-October/1221329.html |
94 | 94 | # Some other useful pointers: |