mirror of https://github.com/chriskiehl/Gooey.git
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
31 lines
871 B
from gooey.gui.components.widgets.bases import TextContainer
|
|
import wx
|
|
|
|
from gooey.gui import formatters
|
|
from gooey.gui.lang.i18n import _
|
|
|
|
|
|
class Listbox(TextContainer):
|
|
|
|
def getWidget(self, parent, *args, **options):
|
|
default = _('select_option')
|
|
return wx.ListBox(
|
|
parent=parent,
|
|
choices=self._meta['choices'],
|
|
size=(-1,60),
|
|
style=wx.LB_MULTIPLE
|
|
)
|
|
|
|
def setOptions(self, options):
|
|
self.widget.SetChoices()
|
|
|
|
def setValue(self, values):
|
|
for string in values:
|
|
self.widget.SetStringSelection(string)
|
|
|
|
def getWidgetValue(self):
|
|
return [self.widget.GetString(index)
|
|
for index in self.widget.GetSelections()]
|
|
|
|
def formatOutput(self, metadata, value):
|
|
return formatters.listbox(metadata, value)
|