changeset 462c2af68977 in tryton:5.6
details: https://hg.tryton.org/tryton?cmd=changeset&node=462c2af68977
description:
Limit entry width to a maximum of 120 chars
This avoids creating horizontal scroll with fields with bigger size.
issue10285
review361661002
(grafted from 6b07ac3f3e93966d79c5965e51853f7a39bdea28)
diffstat:
tryton/gui/window/view_form/view/form_gtk/char.py | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diffs (23 lines):
diff -r 758ba2be546a -r 462c2af68977
tryton/gui/window/view_form/view/form_gtk/char.py
--- a/tryton/gui/window/view_form/view/form_gtk/char.py Thu Apr 22 23:47:17
2021 +0200
+++ b/tryton/gui/window/view_form/view/form_gtk/char.py Thu Apr 22 23:51:22
2021 +0200
@@ -55,7 +55,8 @@
entry.set_property('activates_default', True)
if self.record:
field_size = self.record.expr_eval(self.attrs.get('size'))
- entry.set_width_chars(field_size or self.default_width_chars)
+ entry.set_width_chars(
+ min(120, field_size or self.default_width_chars))
entry.set_max_length(field_size or 0)
return entry
@@ -120,7 +121,8 @@
size_entry = self.entry
if self.record:
field_size = self.record.expr_eval(self.attrs.get('size'))
- size_entry.set_width_chars(field_size or self.default_width_chars)
+ size_entry.set_width_chars(
+ min(120, field_size or self.default_width_chars))
size_entry.set_max_length(field_size or 0)
else:
size_entry.set_width_chars(self.default_width_chars)