Ticket #3569: 0002-IconEntry-Workaround-for-incorrect-icon-size-SL-3569.patch

File 0002-IconEntry-Workaround-for-incorrect-icon-size-SL-3569.patch, 1.7 KB (added by manuq, 11 years ago)

Workaround: scale the pixbuf before setting the icon as Carlos proposed in http://bugs.sugarlabs.org/ticket/3385#comment:15

  • src/sugar3/graphics/iconentry.py

    From c4c406dce0cb09c2cc6e82dbcaa9ab1b4c318b18 Mon Sep 17 00:00:00 2001
    From: =?UTF-8?q?Manuel=20Qui=C3=B1ones?= <manuq@laptop.org>
    Date: Tue, 8 Jan 2013 16:12:21 -0300
    Subject: [PATCH toolkit 2/2] IconEntry: Workaround for incorrect icon size -
     SL #3569 - #3385
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    Mail-Followup-To: <sugar-devel@lists.sugarlabs.org>
    
    Signed-off-by: Manuel Quiñones <manuq@laptop.org>
    ---
     src/sugar3/graphics/iconentry.py | 10 ++++++++++
     1 file changed, 10 insertions(+)
    
    diff --git a/src/sugar3/graphics/iconentry.py b/src/sugar3/graphics/iconentry.py
    index f4e5682..5c67a62 100644
    a b from sugar3.graphics.icon import _SVGLoader 
    2828ICON_ENTRY_PRIMARY = Gtk.EntryIconPosition.PRIMARY
    2929ICON_ENTRY_SECONDARY = Gtk.EntryIconPosition.SECONDARY
    3030
     31ENTRY_ICON_SIZE = style.zoom(22)
    3132
    3233class IconEntry(Gtk.Entry):
    3334
    class IconEntry(Gtk.Entry): 
    6364    def set_icon(self, position, pixbuf):
    6465        if type(pixbuf) is not GdkPixbuf.Pixbuf:
    6566            raise ValueError('Argument must be a pixbuf, not %r.' % pixbuf)
     67
     68        # Workaround, GTK+ is not scaling some icons correctly.  See
     69        # tickets #3569 and #3385 .
     70        if (pixbuf.props.width is not ENTRY_ICON_SIZE or
     71            pixbuf.props.height is not ENTRY_ICON_SIZE):
     72            pixbuf = pixbuf.scale_simple(ENTRY_ICON_SIZE,
     73                                         ENTRY_ICON_SIZE,
     74                                         GdkPixbuf.InterpType.BILINEAR)
     75
    6676        self.set_icon_from_pixbuf(position, pixbuf)
    6777
    6878    def remove_icon(self, position):