From 9cf5e60731a114c8db266cf5bacf0805f29ee328 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 9 Feb 2014 23:57:24 +0100 Subject: [PATCH] Fix dynamic size for translate widget Dynamic size was added in changeset 8ee7e142c8fd but the translate widget was not updated. review3271004 (transplanted from 1a9e84ba4d48a8e2ca2a98680e2bff1c66aa7791) --- tryton/gui/window/view_form/view/form_gtk/char.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tryton/gui/window/view_form/view/form_gtk/char.py b/tryton/gui/window/view_form/view/form_gtk/char.py index 55d93273ce..50fbad40c5 100644 --- a/tryton/gui/window/view_form/view/form_gtk/char.py +++ b/tryton/gui/window/view_form/view/form_gtk/char.py @@ -49,8 +49,10 @@ class Char(WidgetInterface, TranslateMixin): def translate_widget(self): entry = gtk.Entry() entry.set_property('activates_default', True) - entry.set_width_chars(int(self.attrs.get('size', -1))) - entry.set_max_length(int(self.attrs.get('size', 0))) + if self.record: + field_size = self.record.expr_eval(self.attrs.get('size')) + entry.set_width_chars(field_size or -1) + entry.set_max_length(field_size or 0) return entry @staticmethod