diff --git a/gooey/gui/model.py b/gooey/gui/model.py index 9973ad3..53462c1 100644 --- a/gooey/gui/model.py +++ b/gooey/gui/model.py @@ -160,6 +160,9 @@ class MyModel(object): self.argument_groups = self.wrap(self.build_spec.get('widgets', {})) self.active_group = iter(self.argument_groups).next() + self.num_required_cols = self.build_spec['num_required_cols'] + self.num_optional_cols = self.build_spec['num_optional_cols'] + self.text_states = { States.CONFIGURING: { 'title': _("settings_title"), diff --git a/gooey/gui/presenter.py b/gooey/gui/presenter.py index a932491..474abe7 100644 --- a/gooey/gui/presenter.py +++ b/gooey/gui/presenter.py @@ -46,8 +46,8 @@ class Presenter(object): self.view.required_section.clear() self.view.optional_section.clear() - self.view.required_section.populate(self.model.required_args) - self.view.optional_section.populate(self.model.optional_args) + self.view.required_section.populate(self.model.required_args, self.model.num_required_cols) + self.view.optional_section.populate(self.model.optional_args, self.model.num_optional_cols) if self.model.use_monospace_font: self.view.set_display_font_style('monospace') diff --git a/gooey/gui/windows/advanced_config.py b/gooey/gui/windows/advanced_config.py index ff35227..8d38884 100644 --- a/gooey/gui/windows/advanced_config.py +++ b/gooey/gui/windows/advanced_config.py @@ -29,7 +29,7 @@ class WidgetContainer(wx.Panel): self.container = wx.BoxSizer(wx.VERTICAL) self.SetSizer(self.container) - def layout(self): + def layout(self, num_columns): STD_LAYOUT = (0, wx.LEFT | wx.RIGHT | wx.EXPAND, PADDING) if self.title: @@ -41,15 +41,15 @@ class WidgetContainer(wx.Panel): self.container.AddSpacer(5) self.container.Add(wx_util.horizontal_rule(self), *STD_LAYOUT) self.container.AddSpacer(20) - self.create_component_grid(self.container, self.widgets, cols=2) + self.create_component_grid(self.container, self.widgets, cols=num_columns) self.container.AddSpacer(10) - def populate(self, widgets): + def populate(self, widgets, num_columns): for index, widget in enumerate(widgets): widget_class = getattr(components, widget.type) widget_instance = widget_class(self, widget.title, widget.help, widget.choices) self.widgets.append(widget_instance) - self.layout() + self.layout(num_columns) def get_values(self): return [x.get_value() for x in self.widgets]