From 45f4acf858cc269e208ceb371c3dd521bf0492a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 3 Nov 2013 20:42:34 +0100 Subject: [PATCH] Don't set image on button if it is still the same It fixes also a strange behavior of GTK that doesn't display any images if the icon is changed before it is realized. issue3191 review1451002 (transplanted from 4bc44691dc89dfd7802c9d84bbb466f98038bb75) --- tryton/common/button.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tryton/common/button.py b/tryton/common/button.py index 2adae35ba6..5a695e8cc3 100644 --- a/tryton/common/button.py +++ b/tryton/common/button.py @@ -17,6 +17,11 @@ class Button(gtk.Button): self._set_icon(attrs.get('icon')) def _set_icon(self, stock): + image = self.get_image() + if not image and not stock: + return + elif image and image.get_stock()[0] == stock: + return if not stock: self.set_image(gtk.Image()) return