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
This commit is contained in:
Cédric Krier committed 2016-10-31 22:50:15 +01:00
1 parent 3ad650bd07
commit 23327ca31e
1 file changed
+6 -3
@@ -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)