From 23327ca31e2fd4761c640b5de412a505ca0ea7d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 31 Oct 2016 22:50:15 +0100 Subject: [PATCH] Grow multiselection widget to show all items if yexpand is not set When there are few options, the widget is often used with no yexpand to look like a normal field. But in this case, some options could be not visible and user could miss them. issue5994 review33551002 --- .../gui/window/view_form/view/form_gtk/multiselection.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tryton/gui/window/view_form/view/form_gtk/multiselection.py b/tryton/gui/window/view_form/view/form_gtk/multiselection.py index c23e33c579..6543290fed 100644 --- a/tryton/gui/window/view_form/view/form_gtk/multiselection.py +++ b/tryton/gui/window/view_form/view/form_gtk/multiselection.py @@ -15,9 +15,12 @@ class MultiSelection(Widget, SelectionMixin): def __init__(self, view, attrs): super(MultiSelection, self).__init__(view, attrs) - self.widget = gtk.ScrolledWindow() - self.widget.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) - self.widget.set_shadow_type(gtk.SHADOW_ETCHED_IN) + if int(attrs.get('yexpand', self.expand)): + self.widget = gtk.ScrolledWindow() + self.widget.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) + self.widget.set_shadow_type(gtk.SHADOW_ETCHED_IN) + else: + self.widget = gtk.VBox() self.widget.get_accessible().set_name(attrs.get('string', '')) self.model = gtk.ListStore(gobject.TYPE_INT, gobject.TYPE_STRING)