From 79f2e2f4f021de9d915a092e47e2e96bde2e6343 Mon Sep 17 00:00:00 2001 From: Clement Lefebvre Date: Wed, 22 Jun 2016 15:35:57 +0100 Subject: [PATCH] Menu icon: Scale svg files to 22px to prevent them from getting too big --- usr/lib/linuxmint/mintMenu/mintMenu.py | 10 +++++++--- usr/lib/linuxmint/mintMenu/mintMenuConfig.py | 5 +++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/usr/lib/linuxmint/mintMenu/mintMenu.py b/usr/lib/linuxmint/mintMenu/mintMenu.py index 8489665..0945e4d 100755 --- a/usr/lib/linuxmint/mintMenu/mintMenu.py +++ b/usr/lib/linuxmint/mintMenu/mintMenu.py @@ -551,13 +551,17 @@ class MenuWin( object ): self.do_image(self.buttonIcon, False) def do_image(self, image_file, saturate): - pixbuf = GdkPixbuf.Pixbuf.new_from_file(image_file) + if image_file.endswith(".svg"): + pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(image_file, -1, 22) + else: + pixbuf = GdkPixbuf.Pixbuf.new_from_file(image_file) if saturate: GdkPixbuf.Pixbuf.saturate_and_pixelate(pixbuf, pixbuf, 1.5, False) self.button_icon.set_from_pixbuf(pixbuf) def createPanelButton( self ): - self.button_icon = Gtk.Image.new_from_file( self.buttonIcon ) + self.button_icon = Gtk.Image() + self.do_image(self.buttonIcon, False) self.systemlabel = Gtk.Label(label= "%s " % self.buttonText ) if os.path.exists("/etc/linuxmint/info"): import commands @@ -656,7 +660,7 @@ class MenuWin( object ): def updateButton( self ): self.systemlabel.set_text( self.buttonText ) self.button_icon.clear() - self.button_icon.set_from_file( self.buttonIcon ) + self.do_image(self.buttonIcon, False) self.sizeButton() def bind_hot_key (self): diff --git a/usr/lib/linuxmint/mintMenu/mintMenuConfig.py b/usr/lib/linuxmint/mintMenu/mintMenuConfig.py index 0ec5297..5e48a8d 100755 --- a/usr/lib/linuxmint/mintMenu/mintMenuConfig.py +++ b/usr/lib/linuxmint/mintMenu/mintMenuConfig.py @@ -5,7 +5,7 @@ import sys import gi gi.require_version("Gtk", "2.0") -from gi.repository import Gtk, Gdk +from gi.repository import Gtk, Gdk, GdkPixbuf import keybinding @@ -343,7 +343,8 @@ class mintMenuConfig( object ): def setButtonIcon( self, value ): self.buttonIconChooser.set_filename(value) - self.buttonIconImage.set_from_file(value) + pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(value, -1, 22) + self.buttonIconImage.set_from_pixbuf(pixbuf) def getShowButtonIcon( self ): return not self.showButtonIcon.get_active()