From e0a9e3503f37b28869fde407ebf76c5bc056bcae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 6 Feb 2008 14:39:11 +0100 Subject: [PATCH] Change states for button to use the same schema than for fields --- tryton/gui/window/view_form/view/form_gtk/parser.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tryton/gui/window/view_form/view/form_gtk/parser.py b/tryton/gui/window/view_form/view/form_gtk/parser.py index 2ea3a996de..53f29d3d74 100644 --- a/tryton/gui/window/view_form/view/form_gtk/parser.py +++ b/tryton/gui/window/view_form/view/form_gtk/parser.py @@ -67,11 +67,12 @@ class Button(object): self.form.screen.display() def state_set(self, values): - if self.attrs.get('states', False): - if eval(self.attrs.get('states', 'True'), values): - self.widget.show() - else: + state_changes = eval(self.attrs.get('states', {})) + if 'invisible' in state_changes: + if eval(state_changes['invisible'], values): self.widget.hide() + else: + self.widget.show() else: self.widget.show()