Esempio n. 1
0
class ECharts(LayoutDOM):
    """
    A Bokeh model that wraps around an ECharts plot and renders it
    inside a Bokeh.
    """

    __javascript__ = [
        "https://cdn.jsdelivr.net/npm/[email protected]/dist/echarts.min.js"
    ]

    __js_skip__ = {'echarts': __javascript__[:1]}

    __js_require__ = {
        'baseUrl': 'https://cdn.jsdelivr.net/npm/',
        'paths': {
            "echarts": "[email protected]/dist/echarts.min"
        },
        'exports': {}
    }

    data = Dict(String, Any)

    renderer = Enum("canvas", "svg")

    theme = Enum("default", "light", "dark")
Esempio n. 2
0
 def test_Enum(self) -> None:
     p = Enum("red", "green")
     with pytest.raises(ValueError) as e:
         p.validate("junk")
     assert matches(
         str(e.value),
         r"invalid value: 'junk'; allowed values are red or green")
class ECharts(LayoutDOM):
    """
    A Bokeh model that wraps around an ECharts plot and renders it
    inside a Bokeh.
    """

    __javascript_raw__ = [
        "https://cdn.jsdelivr.net/npm/[email protected]/dist/echarts.min.js",
        "https://cdn.jsdelivr.net/npm/[email protected]/dist/echarts-gl.min.js"
    ]

    @classproperty
    def __javascript__(cls):
        return bundled_files(cls)

    @classproperty
    def __js_skip__(cls):
        return {'echarts': cls.__javascript__[:1]}

    __js_require__ = {
        'paths': {
            "echarts":
            "https://cdn.jsdelivr.net/npm/[email protected]/dist/echarts.min",
            "echarts-gl":
            "https://cdn.jsdelivr.net/npm/[email protected]/dist/echarts-gl.min.js"
        },
        'exports': {}
    }

    data = Dict(String, Any)

    renderer = Enum("canvas", "svg")

    theme = Enum("default", "light", "dark")
class FontAwesomeIcon(AbstractIcon):
    """ A "stock" icon based on FontAwesome. """

    __implementation__ = "fontawesome_icon.ts"
    __dependencies__ = {"font-awesome": "^4.6.3"}

    icon_name = Enum(NamedIcon,
                     default="check",
                     help="""
    What icon to use. See http://fortawesome.github.io/Font-Awesome/icons/
    for the list of available icons.
    """)

    size = Float(1,
                 help="""
    The size multiplier (1x, 2x, ..., 5x).
    """)

    flip = Enum("horizontal",
                "vertical",
                default=None,
                help="""
    Optionally flip the icon horizontally or vertically.
    """)

    spin = Bool(False,
                help="""
    Indicates a spinning (animated) icon. This value is ignored for
    icons that do not support spinning.
    """)
Esempio n. 5
0
class DataTabulator(HTMLBox):
    """A Bokeh Model that enables easy use of Tabulator tables
    See http://tabulator.info/
    """

    configuration = Dict(String, Any)

    columns = List(Instance(TableColumn), help="""
    The list of child column widgets.
    """)

    download = Bool(default=False)

    editable = Bool(default=True)

    filename = String(default="table.csv")

    follow = Bool(True)

    frozen_rows = List(Int)

    groupby = List(String)

    hidden_columns = List(String)

    layout = Enum('fit_data', 'fit_data_fill', 'fit_data_stretch', 'fit_data_table', 'fit_columns', default="fit_data")

    source = Instance(ColumnDataSource)

    styles = Dict(Int, Dict(Int, List(String)))

    pagination = Nullable(String)

    page = Nullable(Int)

    page_size = Int()

    max_page = Int()

    sorters = List(Dict(String, String))

    theme = Enum(*TABULATOR_THEMES, default="simple")

    theme_url = String(default=THEME_URL)

    __css__ = [THEME_URL+'tabulator_simple.min.css']

    __javascript__ = [
        JS_SRC,
        MOMENT_SRC
    ]

    __js_require__ = {
        'paths': {
            'tabulator': JS_SRC[:-3]
        },
        'exports': {'tabulator': 'Tabulator'}
    }
Esempio n. 6
0
class IonRangeSlider(InputWidget):
    # The special class attribute ``__implementation__`` should contain a string
    # of JavaScript, TypeScript or CoffeeScript code that implements the web broser
    # side of the custom extension model or a string name of a file with the implementation.

    __implementation__ = 'extensions_ion_range_slider.ts'
    __javascript__ = ["https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js",
                      "https://cdnjs.cloudflare.com/ajax/libs/ion-rangeslider/2.1.4/js/ion.rangeSlider.js"]
    __css__ = ["https://cdnjs.cloudflare.com/ajax/libs/normalize/4.2.0/normalize.css",
               "https://cdnjs.cloudflare.com/ajax/libs/ion-rangeslider/2.1.4/css/ion.rangeSlider.css",
               "https://cdnjs.cloudflare.com/ajax/libs/ion-rangeslider/2.1.4/css/ion.rangeSlider.skinFlat.min.css",
               "https://cdnjs.cloudflare.com/ajax/libs/ion-rangeslider/2.1.4/img/sprite-skin-flat.png"]

    # Below are all the "properties" for this model. Bokeh properties are
    # class attributes that define the fields (and their types) that can be
    # communicated automatically between Python and the browser. Properties
    # also support type validation. More information about properties in
    # can be found here:
    #
    #    https://bokeh.pydata.org/en/latest/docs/reference/core.html#bokeh-core-properties

    disable = Bool(default=True, help="""
    Enable or disable the slider.
    """)

    grid = Bool(default=True, help="""
    Show or hide the grid beneath the slider.
    """)

    start = Float(default=0, help="""
    The minimum allowable value.
    """)

    end = Float(default=1, help="""
    The maximum allowable value.
    """)

    range = Tuple(Float, Float, help="""
    The start and end values for the range.
    """)

    step = Float(default=0.1, help="""
    The step between consecutive values.
    """)

    callback = Instance(Callback, help="""
    A callback to run in the browser whenever the current Slider value changes.
    """)

    callback_throttle = Float(default=200, help="""
    Number of microseconds to pause between callback calls as the slider is moved.
    """)

    callback_policy = Enum(SliderCallbackPolicy, default="throttle", help="""
    When the callback is initiated. This parameter can take on only one of three options:
       "continuous": the callback will be executed immediately for each movement of the slider
       "throttle": the callback will be executed at most every ``callback_throttle`` milliseconds.
       "mouseup": the callback will be executed only once when the slider is released.
       The `mouseup` policy is intended for scenarios in which the callback is expensive in time.
    """)
Esempio n. 7
0
class PlotlyPlot(LayoutDOM):
    """
    A bokeh model that wraps around a plotly plot and renders it inside
    a bokeh plot.
    """

    __javascript__ = ['https://cdn.plot.ly/plotly-latest.min.js',
                      'https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.15/lodash.min.js']

    __js_require__ = {'paths': {'plotly': 'https://cdn.plot.ly/plotly-latest.min',
                                'lodash': 'https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.15/lodash.min'},
                      'exports': {'plotly': 'Plotly',
                                  'lodash': '_'}}

    __implementation__ = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'plotly.ts')

    data = List(Any)

    layout = Dict(String, Any)

    config = Dict(String, Any)

    data_sources = List(Instance(ColumnDataSource))

    # Callback properties
    relayout_data = Dict(String, Any)
    restyle_data = List(Any)
    click_data = Dict(String, Any)
    hover_data = Dict(String, Any)
    clickannotation_data = Dict(String, Any)
    selected_data = Dict(String, Any)
    viewport = Dict(String, Any)
    viewport_update_policy = Enum( "mouseup", "continuous", "throttle")
    viewport_update_throttle = Int()
    _render_count = Int()
Esempio n. 8
0
def test_Property_wrap() -> None:
    types = [
        Bool(),
        Int(),
        Float(),
        Complex(),
        String(),
        Enum("Some", "a", "b"),
        Color(),
        Regex("^$"),
        Seq(Any),
        Tuple(Any, Any),
        Instance(_TestModel),
        Any(),
        Interval(Float, 0, 1),
        Either(Int, String),
        DashPattern(),
        Size(),
        Percent(),
        Angle(),
        MinMaxBounds(),
    ]

    for x in types:
        for y in (0, 1, 2.3, "foo", None, (), [], {}):
            r = x.wrap(y)
            assert r == y
            assert isinstance(r, type(y))
Esempio n. 9
0
class Player(Widget):
    """
    The Player widget provides controls to play through a number of frames.
    """

    start = Int(help="Lower bound of the Player slider")

    end = Int(help="Upper bound of the Player slider")

    value = Int(0, help="Current value of the player app")

    step = Int(1, help="Number of steps to advance the player by.")

    interval = Int(500, help="Interval between updates")

    direction = Int(0,
                    help="""
        Current play direction of the Player (-1: playing in reverse,
        0: paused, 1: playing)""")

    loop_policy = Enum('once', 'reflect', 'loop', default='once')

    show_loop_controls = Bool(True,
                              help="""Whether the loop controls
        radio buttons are shown""")

    width = Override(default=400)

    height = Override(default=250)
Esempio n. 10
0
class FileDownload(InputWidget):

    auto = Bool(False, help="""Whether to download on click""")

    button_type = Enum(ButtonType,
                       help="""
    A style for the button, signifying it's role.
    """)

    clicks = Int(0,
                 help="""
    A private property that used to trigger ``on_click`` event handler.
    """)

    data = String(help="""Encoded URI data.""")

    label = String("", help="""The text label for the button to display.""")

    filename = String(help="""Filename to use on download""")

    _transfers = Int(0,
                     help="""
    A private property to create and click the link.
    """)

    title = Override(default='')
Esempio n. 11
0
class Player(Widget):
    """
    The Player widget provides controls to play through a number of frames.
    """

    __implementation__ = os.path.join(
        os.path.abspath(os.path.dirname(__file__)), 'player.ts')

    start = Int(help="Lower bound of the Player slider")

    end = Int(help="Upper bound of the Player slider")

    value = Int(0, help="Current value of the player app")

    step = Int(1, help="Number of steps to advance the player by.")

    interval = Int(500, help="Interval between updates")

    direction = Int(0,
                    help="""
        Current play direction of the Player (-1: playing in reverse,
        0: paused, 1: playing)""")

    loop_policy = Enum('once', 'reflect', 'loop', default='once')

    height = Override(default=250)
Esempio n. 12
0
class FixedZoomOutTool(Action):

    __implementation__ = "fixedZoomOutTool.ts"

    dimensions = Enum(Dimensions, default="both")

    factor = Percent(default=0.1)
Esempio n. 13
0
class VegaPlot(LayoutDOM):
    """
    A Bokeh model that wraps around a Vega plot and renders it inside
    a Bokeh plot.
    """

    __javascript_raw__ = [
        "https://cdn.jsdelivr.net/npm/vega@5",
        'https://cdn.jsdelivr.net/npm/vega-lite@4',
        'https://cdn.jsdelivr.net/npm/vega-embed@6'
    ]

    @classproperty
    def __javascript__(cls):
        return bundled_files(cls)

    @classproperty
    def __js_skip__(cls):
        return {
            'vega': cls.__javascript__[:1],
            'vegaLite': cls.__javascript__[1:2],
            'vegaEmbed': cls.__javascript__[2:]
        }

    __js_require__ = {
        'paths': {
            "vega-embed":
            "https://cdn.jsdelivr.net/npm/vega-embed@6/build/vega-embed.min",
            "vega-lite":
            "https://cdn.jsdelivr.net/npm/vega-lite@4/build/vega-lite.min",
            "vega": "https://cdn.jsdelivr.net/npm/vega@5/build/vega.min"
        },
        'exports': {
            'vega-embed': 'vegaEmbed',
            'vega': 'vega',
            'vega-lite': 'vl'
        }
    }

    data = Nullable(Dict(String, Any))

    data_sources = Dict(String, Instance(ColumnDataSource))

    events = List(String)

    show_actions = Bool(False)

    theme = Nullable(
        Enum('excel',
             'ggplot2',
             'quartz',
             'vox',
             'fivethirtyeight',
             'dark',
             'latimes',
             'urbaninstitute',
             'googlecharts',
             default=None))

    throttle = Dict(String, Int)
class HorizontalBoxZoomTool(Drag):

    __implementation__ = "horizontalBoxZoomTool.ts"

    dimensions = Enum(Dimensions, default="both")
    overlay = Instance(BoxAnnotation, default=DEFAULT_BOX_OVERLAY)
    match_aspect = Bool(default=False)
Esempio n. 15
0
class JSONEditor(HTMLBox):
    """
    A bokeh model that allows editing JSON.
    """

    data = Any()

    menu = Bool(True)

    mode = Enum("tree",
                "view",
                "form",
                "code",
                "text",
                "preview",
                default='tree')

    search = Bool(True)

    selection = List(Any)

    schema = Nullable(Dict(String, Any), default=None)

    templates = List(Any)

    __javascript_raw__ = [
        'https://cdn.jsdelivr.net/npm/[email protected]/dist/jsoneditor.min.js'
    ]

    __css_raw__ = [
        'https://cdn.jsdelivr.net/npm/[email protected]/dist/jsoneditor.min.css'
    ]

    @classproperty
    def __javascript__(cls):
        return bundled_files(cls)

    @classproperty
    def __css__(cls):
        return bundled_files(cls, 'css')

    @classproperty
    def __js_skip__(cls):
        return {'JSONEditor': cls.__javascript__}

    __js_require__ = {
        'paths': {
            'jsoneditor':
            "//cdn.jsdelivr.net/npm/[email protected]/dist/jsoneditor.min"
        },
        'exports': {
            'jsoneditor': 'JSONEditor'
        },
        'shim': {
            'jsoneditor': {
                'exports': "JSONEditor"
            }
        }
    }
Esempio n. 16
0
class LuminoDataGrid(HTMLBox):

    json_data = Dict(String, Any)

    selection_mode = Enum('row', 'column', 'cell')

    selections = List(Dict(String, Any), default=[])

    row_header_width = Int(default=64)

    column_header_height = Int(default=32)

    row_height = Int(default=32)

    column_width = Int(default=128)

    gridstyle = Enum('green', 'blue', 'brown', 'none')
Esempio n. 17
0
class HighTable(TableWidget):
    ''' Two dimensional grid for visualisation and editing large amounts
    of data.
    '''

    __implementation__ = "high_table.coffee"

    columns = List(Instance(TableColumn), help="""
    The list of child column widgets.
    """)

    fit_columns = Bool(True, help="""
    Whether columns should be fit to the available width. This results in no
    horizontal scrollbar showing up, but data can get unreadable if there is
    no enough space available. If set to ``True``, columns' width is
    understood as maximum width.
    """)

    sortable = Bool(True, help="""
    Allows to sort table's contents. By default natural order is preserved.
    To sort a column, click on it's header. Clicking one more time changes
    sort direction. Use Ctrl + click to return to natural order. Use
    Shift + click to sort multiple columns simultaneously.
    """)

    reorderable = Bool(True, help="""
    Allows the reordering of a tables's columns. To reorder a column,
    click and drag a table's header to the desired location in the table.
    The columns on either side will remain in their previous order.
    """)

    editable = Bool(False, help="""
    Allows to edit table's contents. Needs cell editors to be configured on
    columns that are required to be editable.
    """)

    selectable = Either(Bool(True), Enum("checkbox"), help="""
    Whether a table's rows can be selected or not. Using ``checkbox`` is
    equivalent  to ``True``, but makes selection visible through a checkbox
    for each row,  instead of highlighting rows. Multiple selection is
    allowed and can be achieved by either clicking multiple checkboxes (if
    enabled) or using Shift + click on rows.
    """)

    row_headers = Bool(True, help="""
    Enable or disable row headers, i.e. the index column.
    """)

    scroll_to_selection = Bool(True, help="""
    Whenever a selection is made on the data source, scroll the selected
    rows into the table's viewport if none of the selected rows are already
    in the viewport.
    """)

    height = Override(default=400)
Esempio n. 18
0
class CustomTapTool(Tap):

    __implementation__ = "customTapTool.ts"

    names = List(String)

    renderers = List(Instance(Renderer))

    behavior = Enum("select", "inspect", default="select")

    callback = Instance(Callback)
Esempio n. 19
0
class LineGlyph(XyGlyph):
    """Represents a group of data as a line."""

    width = Int(default=2)
    dash = Enum(DashPattern, default='solid')

    def __init__(self,
                 x=None,
                 y=None,
                 color=None,
                 line_color=None,
                 width=None,
                 dash=None,
                 **kwargs):
        kwargs['x'] = x
        kwargs['y'] = y

        if color is not None and line_color is None:
            line_color = color

        if dash is not None:
            kwargs['dash'] = dash

        if width is not None:
            kwargs['width'] = width

        if line_color is not None:
            kwargs['line_color'] = line_color

        super(LineGlyph, self).__init__(**kwargs)
        self.setup()

    def build_source(self):
        if self.x is None:
            x = self.y.index
            data = dict(x_values=x, y_values=self.y)
        elif self.y is None:
            y = self.x.index
            data = dict(x_values=self.x, y_values=y)
        else:
            data = dict(x_values=self.x, y_values=self.y)

        return data

    def build_renderers(self):
        """Yield a `GlyphRenderer` for the group of data."""
        glyph = Line(x='x_values',
                     y='y_values',
                     line_color=self.line_color,
                     line_alpha=self.line_alpha,
                     line_width=self.width,
                     line_dash=self.dash)
        yield GlyphRenderer(glyph=glyph)
Esempio n. 20
0
class PlotlyPlot(LayoutDOM):
    """
    A bokeh model that wraps around a plotly plot and renders it inside
    a bokeh plot.
    """

    __javascript_raw__ = [
        JS_URLS['jQuery'], 'https://cdn.plot.ly/plotly-2.10.1.min.js'
    ]

    @classproperty
    def __javascript__(cls):
        return bundled_files(cls)

    @classproperty
    def __js_skip__(cls):
        return {'Plotly': cls.__javascript__[1:]}

    __js_require__ = {
        'paths': {
            'plotly': 'https://cdn.plot.ly/plotly-2.10.1.min'
        },
        'exports': {
            'plotly': 'Plotly'
        }
    }

    data = List(Any)

    layout = Dict(String, Any)

    config = Dict(String, Any)

    data_sources = List(Instance(ColumnDataSource))

    relayout = Nullable(Dict(String, Any))

    restyle = Nullable(Dict(String, Any))

    # Callback properties
    relayout_data = Dict(String, Any)
    restyle_data = List(Any)
    click_data = Either(Dict(String, Any), Null)
    hover_data = Either(Dict(String, Any), Null)
    clickannotation_data = Either(Dict(String, Any), Null)
    selected_data = Either(Dict(String, Any), Null)
    viewport = Either(Dict(String, Any), Null)
    viewport_update_policy = Enum("mouseup", "continuous", "throttle")
    viewport_update_throttle = Int()
    visibility = Bool(True)
    _render_count = Int()
Esempio n. 21
0
class Progress(HTMLBox):

    active = Bool(True, help="""Whether to animate the bar""")

    bar_color = Enum('primary', 'secondary', 'success', 'info',
                     'danger', 'warning', 'light', 'dark', default='primary')

    max = Int(100, help="""Maximum value""")

    value = Int(help="""Current value""")

    style = Dict(String, Any, default={}, help="""
    Raw CSS style declaration. Note this may be web browser dependent.
    """)
Esempio n. 22
0
class AcePlot(HTMLBox):
    """
    A Bokeh model that wraps around a Ace editor and renders it inside
    a Bokeh plot.
    """

    __javascript__ = [
        'https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.11/ace.js',
        'https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.11/ext-language_tools.js',
        'https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.11/ext-modelist.min.js'
    ]

    __js_skip__ = {'ace': __javascript__}

    __js_require__ = {
        'paths': {
            ('ace', ('ace/ace', 'ace/ext-language_tools')):
            '//cdnjs.cloudflare.com/ajax/libs/ace/1.4.7'
        },
        'exports': {
            'ace': 'ace'
        },
        'shim': {
            'ace/ext-language_tools': {
                'deps': ["ace/ace"]
            },
            'ace/ext-modelist': {
                'deps': ["ace/ace"]
            }
        }
    }

    code = String()

    theme = Enum(ace_themes, default='chrome')

    filename = String()

    language = String()

    annotations = List(Dict(String, Any), default=[])

    readonly = Bool(default=False)

    print_margin = Bool(default=False)

    height = Override(default=300)

    width = Override(default=300)
Esempio n. 23
0
class MultiBrushTool(Drag):
    __implementation__ = "singleBrushTool.ts"
    # source = Instance(ColumnDataSource)
    # plot = Instance(figure)

    names = List(String,
                 help="""
    A list of names to query for. If set, only renderers that
    have a matching value for their ``name`` attribute will be used.
    """)

    renderers = List(Instance(Renderer),
                     help="""
    An explicit list of renderers to hit test again. If unset,
    defaults to all renderers on a plot.
    """)

    select_every_mousemove = Bool(False,
                                  help="""
    Whether a selection computation should happen on every mouse
    event, or only once, when the selection region is completed. Default: False
    """)

    dimensions = Enum(Dimensions,
                      default="both",
                      help="""
    Which dimensions the box selection is to be free in. By default,
    users may freely draw selections boxes with any dimensions. If only
    "width" is supplied, the box will be constrained to span the entire
    vertical space of the plot, only the horizontal dimension can be
    controlled. If only "height" is supplied, the box will be constrained
    to span the entire horizontal space of the plot, and the vertical
    dimension can be controlled.
    """)

    callback = Instance(Callback,
                        help="""
    A callback to run in the browser on completion of drawing a selection box.
    The cb_data parameter that is available to the Callback code will contain
    one BoxSelectTool-specific field:
    :geometry: object containing the coordinates of the selection box
    """)

    overlay = Instance(BoxAnnotation,
                       default=DEFAULT_BOX_OVERLAY,
                       help="""
    A shaded annotation drawn to indicate the selection region.
    """)
Esempio n. 24
0
class VTKVolumePlot(AbstractVTKPlot):
    """
    Bokeh model dedicated to plot a volumetric object with the help of vtk-js
    """

    ambient = Float(default=0.2)

    colormap = String(help="Colormap Name")

    controller_expanded = Bool(default=True,
                               help="""
        If True the volume controller panel options is expanded in the view""")

    data = Nullable(Dict(String, Any))

    diffuse = Float(default=0.7)

    display_slices = Bool(default=False)

    display_volume = Bool(default=True)

    edge_gradient = Float(default=0.2)

    interpolation = Enum(enumeration('fast_linear', 'linear', 'nearest'))

    mapper = Dict(String, Any)

    nan_opacity = Float(default=1)

    render_background = String(default='#52576e')

    rescale = Bool(default=False)

    sampling = Float(default=0.4)

    shadow = Bool(default=True)

    slice_i = Int(default=0)

    slice_j = Int(default=0)

    slice_k = Int(default=0)

    specular = Float(default=0.3)

    specular_power = Float(default=8.)
Esempio n. 25
0
class VideoStream(HTMLBox):

    format = Enum('png', 'jpeg', default='png')

    paused = Bool(False, help="""Whether the video is paused""")

    snapshot = Bool(False, help="""On change generate a snapshot of the current video frame""")

    timeout = Float(None, help="""
        The timeout between snapshots (if None snapshot only generated
        when snapshot property is changed""")

    value = Any(help="""Snapshot Data""")

    height = Override(default=240)

    width = Override(default=320)
Esempio n. 26
0
class MeasureJTool(Drag):

    __implementation__ = "measureJTool.ts"

    names = List(String)

    renderers = List(Instance(Renderer))

    select_every_mousemove = Bool(False)

    dimensions = Enum(Dimensions, default="both")

    callback = Instance(Callback)

    overlay = Instance(BoxAnnotation, default=_DEFAULT_BOX_ANNOTATION)

    frequency = Int(500)
    label = Instance(Label)
Esempio n. 27
0
class QuillInput(HTMLBox):
    """
    WYSIWYG text editor based on Quill.js
    """

    __css_raw__ = [
        'https://cdn.quilljs.com/1.3.6/quill.bubble.css',
        'https://cdn.quilljs.com/1.3.6/quill.snow.css'
    ]

    __javascript_raw__ = [
        'https://cdn.quilljs.com/1.3.6/quill.js',
    ]

    @classproperty
    def __javascript__(cls):
        return bundled_files(cls)

    @classproperty
    def __css__(cls):
        return bundled_files(cls, 'css')

    @classproperty
    def __js_skip__(cls):
        return {'Quill': cls.__javascript__}

    __js_require__ = {
        'paths': {
            'Quill': 'https://cdn.quilljs.com/1.3.6/quill',
        },
        'exports': {
            'Quill': 'Quill'
        }
    }

    mode = Enum("bubble", "toolbar", default='toolbar')

    placeholder = String()

    readonly = Bool(False)

    text = String()

    toolbar = Either(List(Any), Bool)
Esempio n. 28
0
class CustomBoxSelectTool(Drag):

    __implementation__ = "customBoxSelectTool.ts"

    tool_name = String("Box Select")

    icon = String("bk-tool-icon-box-select")

    names = List(String)

    renderers = List(Instance(Renderer))

    select_every_mousemove = Bool(False)

    dimensions = Enum(Dimensions, default="both")

    callback = Instance(Callback)

    overlay = Instance(BoxAnnotation, default=_DEFAULT_BOX_ANNOTATION)
Esempio n. 29
0
class VTKVolumePlot(AbstractVTKPlot):
    """
    Bokeh model dedicated to plot a volumetric object with the help of vtk-js
    (3D geometry objects are not suported)
    """

    data = Dict(String, Any)

    colormap = String(help="Colormap Name")

    rescale = Bool(default=False)

    shadow = Bool(default=True)

    sampling = Float(default=0.4)

    edge_gradient = Float(default=0.2)

    ambient = Float(default=0.2)

    diffuse = Float(default=0.7)

    specular = Float(default=0.3)

    specular_power = Float(default=8.)

    slice_i = Int(default=0)

    slice_j = Int(default=0)

    slice_k = Int(default=0)

    display_volume = Bool(default=True)

    display_slices = Bool(default=False)

    render_background = String(default='#52576e')

    interpolation = Enum(enumeration('fast_linear', 'linear', 'nearest'))

    mapper = Dict(String, Any)
Esempio n. 30
0
class PlotlyPlot(LayoutDOM):
    """
    A bokeh model that wraps around a plotly plot and renders it inside
    a bokeh plot.
    """

    __javascript__ = [
        'https://code.jquery.com/jquery-3.4.1.min.js',
        'https://cdn.plot.ly/plotly-latest.min.js'
    ]

    __js_skip__ = {'Plotly': __javascript__[1:]}

    __js_require__ = {
        'paths': {
            'plotly': 'https://cdn.plot.ly/plotly-latest.min'
        },
        'exports': {
            'plotly': 'Plotly'
        }
    }

    data = List(Any)

    layout = Dict(String, Any)

    config = Dict(String, Any)

    data_sources = List(Instance(ColumnDataSource))

    # Callback properties
    relayout_data = Dict(String, Any)
    restyle_data = List(Any)
    click_data = Dict(String, Any)
    hover_data = Dict(String, Any)
    clickannotation_data = Dict(String, Any)
    selected_data = Dict(String, Any)
    viewport = Dict(String, Any)
    viewport_update_policy = Enum("mouseup", "continuous", "throttle")
    viewport_update_throttle = Int()
    _render_count = Int()
Esempio n. 31
0
 def test_Enum(self, detail):
     p = Enum("red", "green")
     with pytest.raises(ValueError) as e:
         p.validate("junk", detail)
     assert str(e).endswith("ValueError") == (not detail)
Esempio n. 32
0
 def test_Enum(self):
     p = Enum("red", "green")
     with pytest.raises(ValueError) as e:
         p.validate("junk")
     assert not str(e).endswith("ValueError")