Browse Source

added missing column prop

pull/162/head
chriskiehl 8 years ago
parent
commit
a2db13c83e
3 changed files with 9 additions and 6 deletions
  1. 3
      gooey/gui/model.py
  2. 4
      gooey/gui/presenter.py
  3. 8
      gooey/gui/windows/advanced_config.py

3
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"),

4
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')

8
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]

Loading…
Cancel
Save