Ticket #209: fix-svgz.patch

File fix-svgz.patch, 2.6 KB (added by onlyjob, 7 years ago)

patch

  • winswitch/util/icon_util.py

    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  
    6767                logger.sdebug("file does not exist", filename, size_limit)
    6868                return  None
    6969        try:
     70                if filename.lower().endswith("svg") or filename.lower().endswith("svgz"):
     71                        return cairo_load_svg(filename, size_limit)
    7072                if has_gtk:
    7173                        data = gtk_load_scaled_pixmap(filename, size_limit)
    7274                        if data:
    7375                                return    data
    7476                        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)
    7777                return  pil_load_scaled_pixmap(filename, size_limit)
    7878        except ValueError, e:
    7979                if (filename.lower().endswith("xpm")):
     
    8888                logger.serr(None, e, filename, size_limit)
    8989        return  None
    9090
    91 # needs gnome-python2-rsvg aka ...
     91# needs gnome-python2-rsvg aka python-rsvg
    9292# This code was found here:
    9393# http://mail.python.org/pipermail/python-list/2009-October/1221329.html
    9494# Some other useful pointers: