You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
871 B

  1. from gooey.gui.components.widgets.bases import TextContainer
  2. import wx
  3. from gooey.gui import formatters
  4. from gooey.gui.lang.i18n import _
  5. class Listbox(TextContainer):
  6. def getWidget(self, parent, *args, **options):
  7. default = _('select_option')
  8. return wx.ListBox(
  9. parent=parent,
  10. choices=self._meta['choices'],
  11. size=(-1,60),
  12. style=wx.LB_MULTIPLE
  13. )
  14. def setOptions(self, options):
  15. self.widget.SetChoices()
  16. def setValue(self, values):
  17. for string in values:
  18. self.widget.SetStringSelection(string)
  19. def getWidgetValue(self):
  20. return [self.widget.GetString(index)
  21. for index in self.widget.GetSelections()]
  22. def formatOutput(self, metadata, value):
  23. return formatters.listbox(metadata, value)