class Card(Column): active_header_background = Nullable( String, help="Background color of active Card header.") button_css_classes = List( String, help="CSS classes to add to the Card collapse button.") collapsed = Bool(True, help="Whether the Card is collapsed.") collapsible = Bool( True, help="Whether the Card should have a button to collapse it.") header_background = Nullable(String, help="Background color of the Card header.") header_color = Nullable(String, help="Color of the header text and button.") header_css_classes = List(String, help="CSS classes to add to the Card header.") header_tag = String('div', help="HTML tag to use for the Card header.") hide_header = Bool(False, help="Whether to hide the Card header") tag = String('tag', help="CSS class to use for the Card as a whole.")
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 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'} }
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()
class DerivedDataModel(SomeDataModel): prop3 = Int() prop4 = Int(default=112) prop5 = List(Int, default=[1, 2, 3, 4]) prop6 = Nullable(Instance(SomeDataModel)) prop2 = Override(default=119)
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" } } }
class VTKJSPlot(AbstractVTKPlot): """ Bokeh model for plotting a 3D scene saved in the `.vtk-js` format """ data = Nullable(String, help="""The serialized vtk.js data""") enable_keybindings = Bool(default=False)
class HighBase(LayoutDOM): """The Bokeh Model for the HighBase pane""" config = Nullable(Dict(String, Any)) config_update = Nullable(Dict(String, Any)) _add_series = Nullable(Dict(String, Any)) # Events event = Nullable(Dict(String, Any)) __javascript__ = [ "https://code.highcharts.com/highcharts.js", "https://code.highcharts.com/modules/export-data.js", "https://code.highcharts.com/modules/exporting.js", ] @classproperty def __js_skip__(cls) -> Dict: # pylint: disable=no-self-argument return { "highcharts": cls.__javascript__, } # https://api.highcharts.com/class-reference/#toc5 __js_require__ = { "packages": [ { "name": "highcharts", "main": "highcharts", }, ], "paths": { "highcharts": "https://code.highcharts.com", "highcharts/modules/exporting": "https://code.highcharts.com/modules/exporting", "highcharts/modules/export-data": "https://code.highcharts.com/modules/export-data", }, "exports": { "highcharts": "Highcharts", "highcharts/modules/exporting": "highchartsmodulesexporting", "highcharts/modules/export-data": "highchartsmodulesexportdata", }, }
class Child(Parent): int2 = Nullable(Int()) str2 = String(default="foo") ds2 = NumberSpec(default=field("y")) lst2 = List(Int, default=[1,2,3]) @property def str2_proxy(self): return self.str2 @str2_proxy.setter def str2_proxy(self, value): self.str2 = value*2
class JSON(Markup): """ A bokeh model that renders JSON as tree. """ depth = Either(Nullable(Int), Float, default=1, help="Depth to which the JSON tree is expanded.") hover_preview = Bool( default=False, help="Whether to show a hover preview for collapsed nodes.") theme = String(default='dark', help="Whether to expand all JSON nodes.")
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.)
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))
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 = Nullable(Int, 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)
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 = Nullable(Int, help="""Current value""") style = Dict(String, Any, default={}, help=""" Raw CSS style declaration. Note this may be web browser dependent. """)
class Foo(HasProps): x = Int(12) y = String("hello") z = List(Int, [1, 2, 3]) zz = Dict(String, Int) s = Nullable(String(None))
class CustomMultiSelect(InputWidget): ''' Custom Multi-select widget. ''' __implementation__ = os.path.join("implementation_files", "multiselect.ts") __javascript__ = [ "https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js", "https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.3/js/bootstrap.bundle.min.js", "https://cdnjs.cloudflare.com/ajax/libs/bootstrap-multiselect/0.9.16/js/bootstrap-multiselect.min.js", "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.2/js/all.min.js", ] __css__ = [ "https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.3/css/bootstrap.min.css", "https://cdnjs.cloudflare.com/ajax/libs/bootstrap-multiselect/0.9.16/css/bootstrap-multiselect.min.css", ] options = Either(Dict(String, List(Either(String, Tuple(String, String)))), List(Either(String, Tuple(String, String))), help=""" Available selection options. Options may be provided either as a list of possible string values, or as a list of tuples, each of the form ``(value, label)``. In the latter case, the visible widget text for each value will be corresponding given label. In order to group options, provide a dictionary where each key is the name of a group and its corresponding value is the group options. For example: {"Even": ["2", "4", "6"], "Odd": ["1", "3", "5"]}. Note! the option's value should be unique across all other options and not only the option's group). """) value = Nullable(List(Either(String, List(String))), help=""" Initial or selected values. Note! when the options are grouped the value is a list of tuples that follow the pattern: (<group>, <value>). """) include_select_all = Bool(default=False, help=""" Whether to include a "Select All" option or not. Note! in order to initialize the widget with the "Select All" option checked, set the "select_all" property to True. """) select_all = Bool(default=False, help=""" Whether all the options are selected or not. Note! this property is valid also when the "include_select_all" property is set to false. """) number_displayed = Int(default=1, help=""" Determines how many selected labels should be displayed on the toggle button. """) enable_filtering = Bool(default=False, help=""" Enable filtering options using a search box. """) enabled = Bool(default=True, help=""" Controls whether the widget is enabled (True) or disabled (False). Note! the "disabled" property is not supported in this widget. Use this property instead. """) non_selected_text = String(default="Select...", help=""" The text to display on the toggle button when none of the options are selected. """) is_opt_grouped = Bool(readonly=True, help=""" Indicates whether the widget contains grouped options or not. """) dropdown_closed = Bool(default=False, help=""" This property changes right before the "value" property changes. """) @classmethod def create(cls: Type[T], title: str) -> T: """This function creates a custom multi select filter with a given title. """ return cls( include_select_all=True, enable_filtering=True, options=[], value=[], title=title, sizing_mode='scale_width', margin=[10, 10, 10, 5], css_classes=['custom_select', 'custom'], )
class Readonly(HasProps): x = Int(12, readonly=True) # with default y = Nullable(Int(), readonly=True) # without default z = String("hello")
class SomeModelToJson(Model): child = Instance(Model) null_child = Nullable(Instance(Model)) foo = Int() bar = String()
class AcePlot(HTMLBox): """ A Bokeh model that wraps around a Ace editor and renders it inside a Bokeh plot. """ __javascript_raw__ = [ '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.js' ] __tarball__ = { 'tar': 'https://registry.npmjs.org/ace-builds/-/ace-builds-1.4.11.tgz', 'src': 'package/src-min/', 'dest': 'ajax/libs/1.4.11', 'exclude': ['snippets'] } @classproperty def __javascript__(cls): return bundled_files(cls) @classproperty def __js_skip__(cls): return {'ace': cls.__javascript__} __js_require__ = { 'paths': { ('ace', ('ace/ace', 'ace/ext-language_tools', 'ace/ext-modelist')): '//cdnjs.cloudflare.com/ajax/libs/ace/1.4.7' }, 'exports': { 'ace/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 = Nullable(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)
class DataTabulator(HTMLBox): """A Bokeh Model that enables easy use of Tabulator tables See http://tabulator.info/ """ aggregators = Dict(String, String) buttons = Dict(String, String) configuration = Dict(String, Any) columns = List(Instance(TableColumn), help=""" The list of child column widgets. """) download = Bool(default=False) children = Dict(Int, Instance(LayoutDOM)) editable = Bool(default=True) expanded = List(Int) filename = String(default="table.csv") filters = List(Any) follow = Bool(True) frozen_rows = List(Int) groupby = List(String) hidden_columns = List(String) indexes = 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( String, Either( String, Dict(Int, Dict(Int, List(Either(String, Tuple(String, String))))))) pagination = Nullable(String) page = Nullable(Int) page_size = Int() max_page = Int() sorters = List(Dict(String, String)) select_mode = Any() selectable_rows = Nullable(List(Int)) theme = Enum(*TABULATOR_THEMES, default="simple") theme_url = String(default=THEME_URL) __css_raw__ = CSS_URLS @classproperty def __css__(cls): cls.__css_raw__ = [ url for url in cls.__css_raw__ if 'simple' in url or len(cls.__css_raw__) == 1 ] return bundled_files(cls, 'css') __javascript_raw__ = [JS_SRC, MOMENT_SRC] @classproperty def __javascript__(cls): return bundled_files(cls) @classproperty def __js_skip__(cls): return { 'Tabulator': cls.__javascript__[:1], 'moment': cls.__javascript__[1:] } __js_require__ = { 'paths': { 'tabulator': JS_SRC[:-3], 'moment': MOMENT_SRC[:-3] }, 'exports': { 'tabulator': 'Tabulator', 'moment': 'moment' } }
class DeepModel(Model): child = Nullable(Instance(Model))
class SomeModel(Model): p0 = Int(default=1) p1 = String() p2 = List(Int) p3 = Nullable(Instance(lambda: SomeModel))
class SomeModelInTestPatchDoc(Model): foo = Int(2) child = Nullable(Instance(Model))
class DummyOpts(Options): foo = String(default="thing") bar = Nullable(Int())
class Foo(Model): foo = Nullable(Int()) bar = List(Int, default=[10]) baz = Int(default=20) quux = List(Int, default=[30])
class SomeModelInTestDocument(Model): foo = Int(2) child = Nullable(Instance(Model))
class CustomInspectTool(Tool): __implementation__ = TypeScript(TS_CODE) _active = Nullable(Bool) icon = Image() tool_name = String()
class SomeModelInTestApplication(Model): foo = Int(2) child = Nullable(Instance(Model))
class Perspective(HTMLBox): aggregates = Either(Dict(String, Any), Null()) column_pivots = Either(List(String), Null()) columns = Either(List(String), Null) computed_columns = Either(List(String), Null()) editable = Nullable(Bool()) filters = Either(List(Any), Null()) plugin = String() plugin_config = Either(Dict(String, Any), Null) row_pivots = Either(List(String), Null()) selectable = Nullable(Bool()) schema = Dict(String, String) sort = Either(List(List(String)), Null()) source = Instance(ColumnDataSource) toggle_config = Bool(True) theme = String() # pylint: disable=line-too-long __javascript__ = [ "https://unpkg.com/@finos/[email protected]/dist/umd/perspective.js", "https://unpkg.com/@finos/[email protected]/dist/umd/perspective-viewer.js", "https://unpkg.com/@finos/[email protected]/dist/umd/perspective-viewer-datagrid.js", "https://unpkg.com/@finos/[email protected]/dist/umd/perspective-viewer-hypergrid.js", "https://unpkg.com/@finos/[email protected]/dist/umd/perspective-viewer-d3fc.js", ] __js_skip__ = { "perspective": __javascript__, } __js_require__ = { "paths": { "perspective": "https://unpkg.com/@finos/[email protected]/dist/umd/perspective", "perspective-viewer": "https://unpkg.com/@finos/[email protected]/dist/umd/perspective-viewer", "perspective-viewer-datagrid": "https://unpkg.com/@finos/[email protected]/dist/umd/perspective-viewer-datagrid", "perspective-viewer-hypergrid": "https://unpkg.com/@finos/[email protected]/dist/umd/perspective-viewer-hypergrid", "perspective-viewer-d3fc": "https://unpkg.com/@finos/[email protected]/dist/umd/perspective-viewer-d3fc", }, "exports": { "perspective": "perspective", "perspective-viewer": "PerspectiveViewer", "perspective-viewer-datagrid": "PerspectiveViewerDatagrid", "perspective-viewer-hypergrid": "PerspectiveViewerHypergrid", "perspective-viewer-d3fc": "PerspectiveViewerD3fc", }, } __css__ = [ "https://unpkg.com/@finos/[email protected]/dist/umd/all-themes.css" ]
class SomeModelInTestClientServer(Model): foo = Int(2) child = Nullable(Instance(Model))