Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def getOptions(args, kwargs):
if len(args) > 1:
return args[1][:]
else:
return getValue(kwargs, 'options', [])
def addTextArea(self, *args, **kwargs):
textarea = BeakerxTextArea(
description=self.getDescription(args, kwargs))
textarea.cols = getValue(kwargs, 'width', -1)
textarea.rows = getValue(kwargs, 'height', -1)
textarea.value = getValue(kwargs, 'value', "")
textarea.placeholder = getValue(kwargs, 'placeholder', "")
self.children += (textarea,)
self.components[textarea.description] = textarea
return textarea
def addComboBox(self, *args, **kwargs):
dropdown = BeakerxComboBox(description=self.getDescription(args, kwargs))
dropdown.options = self.getOptions(args, kwargs)
dropdown.original_options = self.getOptions(args, kwargs)
dropdown.editable = getValue(kwargs, 'editable', False)
self.children += (dropdown,)
self.components[dropdown.description] = dropdown
return dropdown
def addTextField(self, *args, **kwargs):
text = BeakerxText(description=self.getDescription(args, kwargs))
text.size = getValue(kwargs, 'width', -1)
self.children += (text,)
self.components[text.description] = text
return text
def addList(self, *args, **kwargs):
multi_select = getValue(kwargs, 'multi', True)
if multi_select:
list = SelectMultipleWithRows(
description=self.getDescription(args, kwargs))
else:
list = SelectMultipleSingle(
description=self.getDescription(args, kwargs))
list.options = self.getOptions(args, kwargs)
list.size = getValue(kwargs, 'rows', len(list.options))
self.children += (list,)
self.components[list.description] = list
return list
def addCheckBox(self, *args, **kwargs):
checkbox = BeakerxCheckbox(description=self.getDescription(args, kwargs))
checkbox.value = getValue(kwargs, 'value', False)
self.children += (checkbox,)
self.components[checkbox.description] = checkbox
return checkbox
def getDescription(args, kwargs):
if len(args) > 0:
return args[0]
else:
return getValue(kwargs, 'description', "")
def addButton(self, *args, **kwargs):
button = BeakerxButton(description=self.getDescription(args, kwargs))
button.tag = getValue(kwargs, 'tag', "")
button.on_click(self.buttonCallback)
self.children += (button,)
return button
labels_dict = dict()
for x in labels:
labels_dict[len(labels_dict)] = x
self._titles = labels_dict
self.children += tuple(childrens)
class Tab(SelectionContainer):
_view_name = Unicode('TabView').tag(sync=True)
_model_name = Unicode('TabModel').tag(sync=True)
def __init__(self, childrens, labels):
super(Tab, self).__init__(childrens, labels)
class SelectMultipleWithRows(SelectMultiple, EasyFormComponent):
def __init__(self, **kwargs):
super(SelectMultipleWithRows, self).__init__(**kwargs)
_view_module = Unicode('beakerx').tag(sync=True)
_model_module = Unicode('beakerx').tag(sync=True)
_model_module_version = Unicode('*').tag(sync=True)
_view_module_version = Unicode('*').tag(sync=True)
size = Int(5, help="The number of rows to display.").tag(sync=True)
class SelectMultipleSingle(Select, EasyFormComponent):
def __init__(self, **kwargs):
super(SelectMultipleSingle, self).__init__(**kwargs)
_view_name = Unicode('SelectMultipleSingleView').tag(sync=True)
_model_name = Unicode('SelectMultipleSingleModel').tag(sync=True)
class BeakerxHTML(HTML, EasyFormComponent):
def __init__(self, *args, **kwargs):
super(BeakerxHTML, self).__init__(**kwargs)
if len(args) > 0:
self.value = args[0]
_view_module = Unicode('beakerx').tag(sync=True)
_model_module = Unicode('beakerx').tag(sync=True)
_model_module_version = Unicode('*').tag(sync=True)
_view_module_version = Unicode('*').tag(sync=True)
layout = InstanceDict(BeakerxLayout).tag(sync=True, **widget_serialization)
style = None
class BeakerxHTMLPre(HTML, EasyFormComponent):
def __init__(self, **kwargs):
super(BeakerxHTMLPre, self).__init__(**kwargs)
_view_name = Unicode('HTMLPreView').tag(sync=True)
_model_name = Unicode('HTMLPreModel').tag(sync=True)
_view_module = Unicode('beakerx').tag(sync=True)
_model_module = Unicode('beakerx').tag(sync=True)
_model_module_version = Unicode('*').tag(sync=True)
_view_module_version = Unicode('*').tag(sync=True)
layout = InstanceDict(BeakerxLayout).tag(sync=True, **widget_serialization)
style = None
class BeakerxButton(Button, EasyFormComponent):
def __init__(self, **kwargs):