From 392c6bc241625ec30380db364b4fc4da9be0895f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 1 May 2010 20:37:33 +0200 Subject: [PATCH] Don't use text value to know the button icon for issue1550 Fix of b9ec0fab5125 The content of the text widget doesn't reflect always the button image as it can be set to empty text without changing the image. --- tryton/gui/window/view_form/view/form_gtk/many2one.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tryton/gui/window/view_form/view/form_gtk/many2one.py b/tryton/gui/window/view_form/view/form_gtk/many2one.py index 7de080c387..9891bc3b26 100644 --- a/tryton/gui/window/view_form/view/form_gtk/many2one.py +++ b/tryton/gui/window/view_form/view/form_gtk/many2one.py @@ -285,15 +285,15 @@ class Many2One(WidgetInterface): self.wid_text.set_text('') self.changed = True return False - prev_res = self.wid_text.get_text() + current_stock = img.get_stock()[0] res = field.get_client(record) self.wid_text.set_text((res and str(res)) or '') img = gtk.Image() - if res and not prev_res: + if res and current_stock != 'tryton-open': img.set_from_stock('tryton-open', gtk.ICON_SIZE_SMALL_TOOLBAR) self.but_open.set_image(img) self.tooltips.set_tip(self.but_open, _('Open a record')) - elif not res and prev_res: + elif not res and current_stock != 'tryton-find': img.set_from_stock('tryton-find', gtk.ICON_SIZE_SMALL_TOOLBAR) self.but_open.set_image(img) self.tooltips.set_tip(self.but_open, _('Search a record'))