class FastTextInput(_BkTextInput): # value is inherited # placeholder is inherited # list is not supported appearance = properties.String( help= """Determines the appearance of the textinput. One of `outline` or `filled`. Defaults to outlined""", ) autofocus = properties.Bool( help="""The autofocus attribute. Defaults to `False`""", ) type_of_text = properties.String( help= """Determines the type of text accepted. One of `email`, `password`, `tel`, `text` or `url`. Defaults to text. """) max_length = properties.Int( help="""The maximum length of the text string""", ) min_length = properties.Int( help="""The minimum length of the text string""", ) pattern = properties.String( help= """A regular expression that the input's value must match in order for the value to pass constraint validation""" ) size = properties.Int( help= """Valid for email, password, tel, and text input types only. Specifies how much of the input is shown""", ) spellcheck = properties.Bool( help="""Whether or not the spell check is enabled. Default is False""") required = properties.Bool( help= """Whether or not the FastTextInput is required. Default is False""") readonly = properties.Bool( help= """Whether or not the FastTextInput is readonly. Default is False""")
class KeyboardResponder(LayoutDOM): #__implementation__ = TypeScript(KEYBOARDRESPONDERCODE_TS) __implementation__ = "keyboardresponder.ts" # can use # __css__ = '<a css file.css>' # can use # __javascript__ = 'katex.min.js' keycode = properties.Int(default=0) # this should match with javascript key_num_presses = properties.Int(default=0) keypress_callback = properties.Instance(bokeh.models.callbacks.Callback, help=""" A callback to run in the browser whenever a key is pressed """)
class FastTextAreaInput(_BkTextAreaInput): """The FastTextAreaInput enables using the `fast-textarea-input` with Bokeh.""" # value is inherited # placeholder is inherited # max_length is inherited # cols is inherited # rows is inherited appearance = properties.String( help= """Determines the appearance of the textinput. One of `outline` or `filled`. Defaults to outlined""", ) autofocus = properties.Bool( help="""The autofocus attribute. Defaults to `False`""", ) resize = properties.String(help="""The resize attribute. One of `None`, `both`, `horizontal` or `vertical`. Defaults to `None`.""", ) min_length = properties.Int( help="""The minimum length of the text string""", ) spellcheck = properties.Bool( help="""Whether or not the spell check is enabled. Default is False""") required = properties.Bool( help= """Whether or not the FastTextInput is required. Default is False""") readonly = properties.Bool( help= """Whether or not the FastTextInput is readonly. Default is False""")
class DpxToolbar(Widget): "Toolbar model" __css__ = route("view.css", "icons.css", "toolbar.css") __implementation__ = 'toolbar.ts' __javascript__ = route() frozen = props.Bool(True) open = props.Int(0) save = props.Int(0) doc = props.Int(0) quit = props.Int(0) bead = props.Int(-1) discarded = props.String('') accepted = props.String('') currentbead = props.Bool(True) currentfile = props.Int(-1) delfile = props.Int(-1) filelist = props.List(props.String) seltype = props.Bool(True) message = props.String('') helpmessage = props.String('') hasquit = props.Bool(False) hasdoc = props.Bool(False) def __init__(self, **kwa): super().__init__(name='Main:toolbar', **kwa)
class Icon(AbstractIcon): """The Icon can be used to add SVG based icons to buttons, menus etc.""" label = properties.String() text = properties.String( default="", help="""The text or HTML contents of the widget.""") size = properties.Float() fill_color = properties.String() spin_duration = properties.Int()
class KeyModResponder(LayoutDOM): """capture all aspects of keydown/up events""" #__implementation__ = TypeScript(KEYBOARDRESPONDERCODE_TS) __implementation__ = "keymodresponder.ts" # can use # __css__ = '<a css file.css>' # can use # __javascript__ = 'katex.min.js' # for additional javascript # this should match with javascript/typescript implementation key = properties.String(default="") keyCode = properties.Int(default=0) altKey = properties.Bool(default=False) ctrlKey = properties.Bool(default=False) metaKey = properties.Bool(default=False) shiftKey = properties.Bool(default=False) key_num_presses = properties.Int(default=0) keypress_callback = properties.Instance(bokeh.models.callbacks.Callback, help=""" A callback to run in the browser whenever a key is pressed """)
class DpxRamp(Widget): "Interface to filters needed for cleaning" __css__ = route("ramp.css") __javascript__ = route() __implementation__ = "_widget.ts" frozen = props.Bool(True) minhfsigma = props.Float(RampStatsTask.hfsigma[0]) maxhfsigma = props.Float(RampStatsTask.hfsigma[1]) minextension = props.Float(RampStatsTask.extension[0]) fixedextension = props.Float(RampStatsTask.extension[1]) maxextension = props.Float(RampStatsTask.extension[2]) displaytype = props.Int(0)
class PeaksSequenceHover( # pylint: disable=too-many-instance-attributes,too-many-ancestors HoverTool, SequenceHoverMixin ): "tooltip over peaks" maxcount = props.Int(3) framerate = props.Float(1.) bias = props.Float(0.) stretch = props.Float(0.) updating = props.String('') biases = props.Dict(props.String, props.Float) stretches = props.Dict(props.String, props.Float) __implementation__ = SequenceHoverMixin.impl( 'PeaksSequenceHover', { 'stretches': ('[p.Any, {}]', 'any'), 'biases': ('[p.Any, {}]', 'any') }, __file__ ) @classmethod def create(cls, ctrl, doc, fig, mdl, xrng = None): # pylint: disable=too-many-arguments "Creates the hover tool for histograms" self = super().create(ctrl, doc, fig, mdl, xrng = xrng) jsc = CustomJS(args = {'fig': fig, 'source': self.source}, code = 'cb_obj.apply_update(fig, source)') self.js_on_change("updating", jsc) return self def reset(self, resets, ctrl, mdl): # pylint: disable=arguments-differ "Creates the hover tool for histograms" super().reset(resets, ctrl, mdl, biases = {i: j.bias for i, j in mdl.distances.items()}, stretches = {i: j.stretch for i, j in mdl.distances.items()}) def jsslaveaxes(self, fig, src): # pylint: disable=arguments-differ "slaves a histogram's axes to its y-axis" rng = fig.y_range rng.callback = CustomJS(code = "hvr.on_change_bounds(fig, src)", args = dict(fig = fig, src = src, hvr = self)) rng = fig.extra_y_ranges["bases"] rng.callback = CustomJS(code = "hvr.on_change_bases(fig)", args = dict(fig = fig, hvr = self))
class DpxCleaning(Widget): "Interface to filters needed for cleaning" __css__ = route("cleaning.css") __javascript__ = route() __implementation__ = "_widget.ts" frozen = props.Bool(True) framerate = props.Float(30.) figure = props.Instance(Figure) fixedbeads = props.String("") subtracted = props.String("") subtractcurrent = props.Int(0) maxabsvalue = props.Float(getattr(DataCleaningTask, 'maxabsvalue')) maxderivate = props.Float(getattr(DataCleaningTask, 'maxderivate')) minpopulation = props.Float(getattr(DataCleaningTask, 'minpopulation')) minhfsigma = props.Float(getattr(DataCleaningTask, 'minhfsigma')) maxhfsigma = props.Float(getattr(DataCleaningTask, 'maxhfsigma')) minextent = props.Float(getattr(DataCleaningTask, 'minextent')) maxextent = props.Float(getattr(DataCleaningTask, 'maxextent')) maxsaturation = props.Float(getattr(DataCleaningTask, 'maxsaturation'))
p.class_, param.Parameterized) else bp.Any(**kwargs)), pm.Color: lambda p, kwargs: bp.Color(**kwargs), pm.DataFrame: lambda p, kwargs: (bp.ColumnData(bp.Any, bp.Seq(bp.Any), **kwargs), [( bp.PandasDataFrame, lambda x: ColumnDataSource._data_from_df(x))]), pm.DateRange: lambda p, kwargs: bp.Tuple(bp.Datetime, bp.Datetime, **kwargs), pm.Date: lambda p, kwargs: bp.Datetime(**kwargs), pm.Dict: lambda p, kwargs: bp.Dict(bp.String, bp.Any, **kwargs), pm.Event: lambda p, kwargs: bp.Bool(**kwargs), pm.Integer: lambda p, kwargs: bp.Int(**kwargs), pm.List: lambda p, kwargs: bp.List(bp.Any, **kwargs), pm.Number: lambda p, kwargs: bp.Float(**kwargs), pm.NumericTuple: lambda p, kwargs: bp.Tuple(*(bp.Float for p in p.length), **kwargs), pm.Range: lambda p, kwargs: bp.Tuple(bp.Float, bp.Float, **kwargs), pm.String: lambda p, kwargs: bp.String(**kwargs), pm.Tuple: lambda p, kwargs: bp.Tuple(*(bp.Any for p in p.length), **kwargs), }
class DpxHoverModel( HoverTool, # pylint: disable=too-many-instance-attributes,too-many-ancestors SequenceHoverMixin): "controls keypress actions" maxcount = props.Int(3) framerate = props.Float(1.) shape = props.Tuple(props.Int, props.Int, default=(0, 0)) cycle = props.Int(-1) bias = props.Float(0.) stretch = props.Float(0.) updating = props.String('') rawrend = props.Instance(Renderer) impl = SequenceHoverMixin.impl __implementation__ = impl( 'DpxHoverModel', { '_hvr_cnt': ('[p.Number, -1]', 'number'), 'shape': ('[p.Array, [2,1]]', 'number[]'), 'cycle': ('[p.Int, -1]', 'number'), 'rawrend': ('[p.Instance, null]', 'any') }, __file__) @staticmethod def _createrawdata(data, shape): return dict(t=data['t'][:shape[1]], z=data['z'][:shape[1]]) @staticmethod def __settooltips(fig, theme): tooltips = theme.tooltips hover = fig.select(DpxHoverTool) if tooltips is None or len(tooltips) == 0: if len(hover): hover[0].tooltips = None elif len(hover): name = theme.raw.glyph rend = [ i for i in fig.renderers if hasattr(i, 'glyph') and type(i.glyph).__name__.lower() == name ][0] hover[0].tooltips = tooltips hover[0].renderers = [rend] rend.selection_glyph = None rend.nonselection_glyph = None rend.glyph.radius_dimension = 'x' rend.glyph.radius = theme.radius def __settap(self, mdl, fig, source, theme): tap = fig.select(TapTool) if tap is not None and len(tap): src = ColumnDataSource(self._createrawdata(source.data, self.shape)) sel = themed(mdl, theme.selection) glyph = PlotAttrsView(sel).addto(fig, x='t', y='z', source=src) args = dict(hvr=self, hvrsrc=src, rawsrc=source, glyph=glyph) code = "hvr.launch_hover(rawsrc, hvrsrc, glyph)" self.rawrend = glyph source.callback = CustomJS(code=code, args=args) def createraw(self, mdl, fig, source, shape, theme): # pylint: disable=too-many-arguments "creates the hover tool" self.shape = tuple(shape) self.__settooltips(fig, theme) self.__settap(mdl, fig, source, theme) def slaveaxes(self, fig, src): "slaves a histogram's axes to its y-axis" fig.y_range.callback = CustomJS( code="hvr.on_change_hist_bounds(fig, src)", args=dict(hvr=self, fig=fig, src=src)) def resetraw(self, fig, rdata, shape, resets): "updates the tooltips for a new file" hover = fig.select(DpxHoverTool) if len(hover) == 0: return resets[self]['shape'] = shape if self.rawrend is not None: resets[self.rawrend]['visible'] = False resets[self.rawrend.data_source]['data'] = self._createrawdata( rdata, shape)