def addComboBox(self, **kwargs): dropdown = ComboBox(description=getValue(kwargs, 'description', "")) dropdown.options = getValue(kwargs, 'options', []) dropdown.editable = getValue(kwargs, 'editable', False) self.children += (dropdown, ) return dropdown
def addTextArea(self, *args, **kwargs): textarea = TextArea(description=self.getDescription(args, kwargs)) textarea.layout.width = str(getValue(kwargs, 'width', 380)) + "px" height = getValue(kwargs, 'height', -1) if height != -1: textarea.layout.height = str(height) + "px" self.children += (textarea, ) return textarea
def __init__(self, **kwargs): super(XYChart, self).__init__(**kwargs) self.graphics_list = getValue(kwargs, 'graphics', []) self.constant_lines = getValue(kwargs, 'constantLines', []) self.constant_bands = getValue(kwargs, 'constantBands', []) self.texts = getValue(kwargs, 'texts', []) self.x_auto_range = getValue(kwargs, 'xAutoRange', True) self.x_lower_bound = getValue(kwargs, 'xLowerBound', 0) self.x_upper_bound = getValue(kwargs, 'xUpperBound', 0) self.log_x = getValue(kwargs, 'logX', False) self.x_log_base = getValue(kwargs, 'xLogBase', 10) self.lodThreshold = getValue(kwargs, 'lodThreshold')
def addRadioButtons(self, **kwargs): orientation = getValue(kwargs, 'orientation', EasyForm.VERTICAL) radio_buttons = RadioButtons(options=getValue(kwargs, 'options', []), description=getValue(kwargs, 'value', "")) if orientation == EasyForm.VERTICAL: self.children += (radio_buttons, ) else: box = HBox() box.children += (radio_buttons, ) self.children += (box, ) return radio_buttons
def addList(self, **kwargs): multi_select = getValue(kwargs, 'multi', True) if multi_select: list = SelectMultipleWithRows( description=getValue(kwargs, 'description', "")) else: list = SelectMultipleSingle( description=getValue(kwargs, 'description', "")) list.options = getValue(kwargs, 'options', []) list.size = getValue(kwargs, 'rows', 2) self.children += (list, ) return list
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', 2) self.children += (list, ) return list
def addButton(self, *args, **kwargs): button = Button(description=self.getDescription(args, kwargs)) button.tag = getValue(kwargs, 'tag', "") button.on_click(self.buttonCallback) self.children += (button, ) return button
def addComboBox(self, *args, **kwargs): dropdown = ComboBox(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, ) return dropdown
def addCheckBoxes(self, *args, **kwargs): layout = HBox() orientation = getValue(kwargs, 'orientation', 2) if orientation == EasyForm.HORIZONTAL: box = HBox() else: box = VBox() for checkBoxItem in self.getOptions(args, kwargs): checkbox = Checkbox(description=checkBoxItem) box.children += (checkbox, ) layout.children += ( Label(value=getValue(kwargs, 'value', "")), box, ) self.children += (layout, ) return layout
def __init__(self, **kwargs): BaseObject.__init__(self) self.init_width = getValue(kwargs, 'initWidth', 640) self.init_height = getValue(kwargs, 'initHeight', 480) self.chart_title = getValue(kwargs, 'title') self.show_legend = getValue(kwargs, 'showLegend') self.use_tool_tip = getValue(kwargs, 'useToolTip', True) self.legend_position = getValue(kwargs, 'legendPosition', LegendPosition()) self.legend_layout = getValue(kwargs, 'legendLayout', LegendLayout.VERTICAL)
def __init__(self, **kwargs): super(Chart, self).__init__(**kwargs) self.init_width = getValue(kwargs, 'initWidth', 640) self.init_height = getValue(kwargs, 'initHeight', 480) self.chart_title = getValue(kwargs, 'title') self.show_legend = getValue(kwargs, 'showLegend') self.use_tool_tip = getValue(kwargs, 'useToolTip', True) self.legend_position = getValue(kwargs, 'legendPosition', LegendPosition()) self.legend_layout = getValue(kwargs, 'legendLayout', LegendLayout.VERTICAL)
def __init__(self, **kwargs): BaseObject.__init__(self) self.init_width = getValue(kwargs, 'initWidth', 640) self.init_height = getValue(kwargs, 'initHeight', 480) self.title = getValue(kwargs, 'title') self.x_label = getValue(kwargs, 'xLabel') self.plots = getValue(kwargs, 'plots', []) self.weights = getValue(kwargs, 'weights', []) self.version = 'groovy'
def __init__(self, **kwargs): super(CombinedChart, self).__init__(**kwargs) self.init_width = getValue(kwargs, 'initWidth', 640) self.init_height = getValue(kwargs, 'initHeight', 480) self.title = getValue(kwargs, 'title') self.x_label = getValue(kwargs, 'xLabel', 'Linear') self.plots = getValue(kwargs, 'plots', []) self.weights = getValue(kwargs, 'weights', []) self.version = 'groovy' self.type= 'CombinedPlot' self.y_tickLabels_visible = True self.x_tickLabels_visible = True self.plot_type = 'Plot'
def __init__(self, **kwargs): super(CombinedChart, self).__init__(**kwargs) self.init_width = getValue(kwargs, 'initWidth', 640) self.init_height = getValue(kwargs, 'initHeight', 480) self.title = getValue(kwargs, 'title') self.x_label = getValue(kwargs, 'xLabel', 'Linear') self.plots = getValue(kwargs, 'plots', []) self.weights = getValue(kwargs, 'weights', []) self.version = 'groovy' self.type = 'CombinedPlot' self.y_tickLabels_visible = True self.x_tickLabels_visible = True self.plot_type = 'Plot'
def __init__(self, **kwargs): super(AbstractChart, self).__init__(**kwargs) self.rangeAxes = getValue(kwargs, 'yAxes', []) if len(self.rangeAxes) == 0: self.rangeAxes.append(YAxis(**kwargs)) self.domain_axis_label = getValue(kwargs, 'xLabel') self.y_label = getValue(kwargs, 'yLabel') self.x_lower_margin = getValue(kwargs, 'xLowerMargin', 0.05) self.x_upper_margin = getValue(kwargs, 'xUpperMargin', 0.05) self.y_auto_range = getValue(kwargs, 'yAutoRange') self.y_auto_range_includes_zero = getValue(kwargs, 'yAutoRangeIncludesZero') self.y_lower_margin = getValue(kwargs, 'yLowerMargin') self.y_upper_margin = getValue(kwargs, 'yUpperMargin') self.y_lower_bound = getValue(kwargs, 'yLowerBound') self.y_upper_bound = getValue(kwargs, 'yUpperBound') self.log_y = getValue(kwargs, 'logY', False) self.omit_checkboxes = getValue(kwargs, 'omitCheckboxes', False) self.crosshair = getValue(kwargs, 'crosshair') self.timezone = getValue(kwargs, 'timeZone')
def addTextArea(self, **kwargs): textarea = TextArea(description=getValue(kwargs, 'description', "")) textarea.width = str(getValue(kwargs, 'width', 200)) + "px" textarea.height = str(getValue(kwargs, 'height', 200)) + "px" self.children += (textarea, ) return textarea
def addButton(self, **kwargs): button = Button(description=getValue(kwargs, 'description', "")) button.tag = getValue(kwargs, 'tag', "") self.children += (button, ) return button
def addTextField(self, *args, **kwargs): text = Text(description=self.getDescription(args, kwargs)) text.layout.width = str(getValue(kwargs, 'width', 380)) + 'px' self.children += (text, ) return text
def __init__(self, *args, **kwargs): super(EasyForm, self).__init__(**kwargs) self.easyFormName = getValue(kwargs, 'title', "") if self.easyFormName == "" and len(args) > 0: self.easyFormName = args[0]
def addDatePicker(self, **kwargs): data_picker = DatePicker( description=getValue(kwargs, 'description', "")) self.children += (data_picker, ) return data_picker
def __init__(self, *args, **kwargs): super(SimpleTimePlot, self).__init__(**kwargs) self.chart.type = 'TimePlot' self.use_tool_tip = True self.show_legend = True self.domain_axis_label = 'Time' displayNames = getValue(kwargs, 'displayNames') displayLines = getValue(kwargs, 'displayLines', True) displayPoints = getValue(kwargs, 'displayPoints', False) timeColumn = getValue(kwargs, 'timeColumn', 'time') colors = getValue(kwargs, 'colors') if len(args) > 0: tableData = args[0] else: tableData = [] if len(args) == 2: columnNames = args[1] else: columnNames = [] xs = [] yss = [] dataColumnsNames = [] if tableData is not None and columnNames is not None: dataColumnsNames.extend(list(tableData[0])) for row in tableData: x = row[timeColumn] x = date_time_2_millis(x) xs.append(x) for idx in range(len(columnNames)): column = columnNames[idx] if (idx >= len(yss)): yss.append([]) yss[idx].append(row[column]) colors = self.getChartColors(columnNames, colors) for i in range(len(yss)): ys = yss[i] if displayLines is True: line = Line(x=xs, y=ys) if displayNames is not None and i < len(displayNames): line.display_name = displayNames[i] else: line.display_name = columnNames[i] if i < len(colors): line.color = colors[i] self.add(line) if displayPoints is True: points = Points(x=xs, y=ys) if displayNames is not None and i < len(displayNames): points.display_name = displayNames[i] else: points.display_name = columnNames[i] if i < len(colors): points.color = colors[i] self.add(points)
def getDescription(args, kwargs): if len(args) > 0: return args[0] else: return getValue(kwargs, 'description', "")
def addTextField(self, **kwargs): text = Text(description=getValue(kwargs, 'description', "")) text.width = getValue(kwargs, 'width', "") self.children += (text, ) return text
def addCheckBox(self, **kwargs): checkbox = Checkbox(description=getValue(kwargs, 'description', "")) self.children += (checkbox, ) return checkbox
def getOptions(args, kwargs): if len(args) > 1: return args[1][:] else: return getValue(kwargs, 'options', [])