From b7d9d063ec5ff9b161f13628a649f304db469364 Mon Sep 17 00:00:00 2001 From: Peng Huang Date: Wed, 9 Sep 2009 14:44:31 +0800 Subject: [PATCH] Use defualt icon for some engine without icon --- ui/gtk/engineabout.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/ui/gtk/engineabout.py b/ui/gtk/engineabout.py index 3d7df5a3..74c82e75 100644 --- a/ui/gtk/engineabout.py +++ b/ui/gtk/engineabout.py @@ -91,13 +91,12 @@ class EngineAbout(gtk.Dialog): left_margin=32) def __load_icon(self, icon): - pixbuf = gdk.pixbuf_new_from_file(icon) - w, h = pixbuf.get_width(), pixbuf.get_height() - rate = max(w, h) / float(48) - w = int(w / rate) - h = int(h / rate) - pixbuf = pixbuf.scale_simple(w, h, gdk.INTERP_BILINEAR) + try: + pixbuf = gdk.pixbuf_new_from_file_at_scale(icon, 48, 48, True) + except: + theme = gtk.icon_theme_get_default() + icon = theme.lookup_icon("ibus", 48, 0) + if icon == None: + icon = theme.lookup_icon("gtk-missing-image", 48, 0) + pixbuf = icon.load_icon() return pixbuf - - - -- 2.34.1