Ejemplo n.º 1
0
    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
Ejemplo n.º 2
0
 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
Ejemplo n.º 3
0
 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')
Ejemplo n.º 4
0
 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')
Ejemplo n.º 5
0
    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
Ejemplo n.º 6
0
    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
Ejemplo n.º 7
0
    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
Ejemplo n.º 8
0
    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
Ejemplo n.º 9
0
    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
Ejemplo n.º 10
0
    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
Ejemplo n.º 11
0
 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)
Ejemplo n.º 12
0
 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)
Ejemplo n.º 13
0
 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'
Ejemplo n.º 14
0
 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'
Ejemplo n.º 15
0
 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'
Ejemplo n.º 16
0
 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')
Ejemplo n.º 17
0
 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
Ejemplo n.º 18
0
    def addButton(self, **kwargs):
        button = Button(description=getValue(kwargs, 'description', ""))
        button.tag = getValue(kwargs, 'tag', "")
        self.children += (button, )

        return button
Ejemplo n.º 19
0
 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
Ejemplo n.º 20
0
 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]
Ejemplo n.º 21
0
    def addDatePicker(self, **kwargs):
        data_picker = DatePicker(
            description=getValue(kwargs, 'description', ""))
        self.children += (data_picker, )

        return data_picker
Ejemplo n.º 22
0
 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')
Ejemplo n.º 23
0
    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)
Ejemplo n.º 24
0
 def getDescription(args, kwargs):
     if len(args) > 0:
         return args[0]
     else:
         return getValue(kwargs, 'description', "")
Ejemplo n.º 25
0
 def addTextField(self, **kwargs):
     text = Text(description=getValue(kwargs, 'description', ""))
     text.width = getValue(kwargs, 'width', "")
     self.children += (text, )
     return text
Ejemplo n.º 26
0
    def addCheckBox(self, **kwargs):
        checkbox = Checkbox(description=getValue(kwargs, 'description', ""))
        self.children += (checkbox, )

        return checkbox
Ejemplo n.º 27
0
 def getOptions(args, kwargs):
     if len(args) > 1:
         return args[1][:]
     else:
         return getValue(kwargs, 'options', [])
Ejemplo n.º 28
0
  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)