def get_children_widgets(self,kwargs): def is_shaoscript(x): return "$" in x if isinstance(x,six.string_types) else False children = [] for k, v in kwargs.items(): kws = self.kwargs_from_key(k) if is_shaoscript(v): children.append(shaoscript(v,kws)) else: if isinstance(v,str): children.append(shaoscript('text$v='+v,kws)) else: children.append(shaoscript(v,kws)) return children
def get_children_widgets(self, kwargs): def is_shaoscript(x): return "$" in x if isinstance(x, six.string_types) else False children = [] for k, v in kwargs.items(): kws = self.kwargs_from_key(k) if is_shaoscript(v): children.append(shaoscript(v, kws)) else: if isinstance(v, str): children.append(shaoscript('text$v=' + v, kws)) else: children.append(shaoscript(v, kws)) return children
def dict_to_children(self,kwargs): def is_shaoscript(x): return "$" in x if isinstance(x,six.string_types) else False children = [] for k, v in kwargs.items(): if is_shaoscript(v): children.append(shaoscript(v)) else: kws = dict(name=k,description=k.capitalize().replace('_',' ')) if not self.__dic_mode is None: kws['mode'] = self.__dic_mode if isinstance(v,str): children.append(shaoscript('text$v='+v,kws)) else: children.append(shaoscript(v,kws)) return children
def dict_to_children(self, kwargs): def is_shaoscript(x): return "$" in x if isinstance(x, six.string_types) else False children = [] for k, v in kwargs.items(): if is_shaoscript(v): children.append(shaoscript(v)) else: kws = dict(name=k, description=k.capitalize().replace('_', ' ')) if not self.__dic_mode is None: kws['mode'] = self.__dic_mode if isinstance(v, str): children.append(shaoscript('text$v=' + v, kws)) else: children.append(shaoscript(v, kws)) return children
def _init_widget(self, shao, kwargs): """Integrates a child Widget as an attribute of the current Dashboard""" widget = scpt.shaoscript(shao, kwargs) try: setattr(self, widget.name, widget) except Exception as e: e.args += (('Dont use widget attributes as shaoscript names,' 'they are reserved words! (You can use dashboard' 'as a generic name if you want)'), ) raise e if widget.mode == 'interactive': self.mode_dict['interactive'] += [widget.name] elif widget.mode == 'passive': self.mode_dict['passive'] += [widget.name] else: self.mode_dict['active'] += [widget.name] self.mode_dict['all'] += [widget.name]
def _init_widget(self, shao, kwargs): """Integrates a child Widget as an attribute of the current Dashboard""" widget = scpt.shaoscript(shao, kwargs) try: setattr(self, widget.name, widget) except Exception as e: e.args += (('Dont use widget attributes as shaoscript names,' 'they are reserved words! (You can use dashboard' 'as a generic name if you want)'),) raise e if 'mode' in kwargs.keys(): if kwargs['mode'] == 'interactive': self.mode_dict['interactive'] += [widget.name] elif kwargs['mode'] == 'passive': self.mode_dict['passive'] += [widget.name] else: self.mode_dict['active'] += [widget.name] else: self.mode_dict['active'] += [widget.name] self.mode_dict['all'] += [widget.name]
def snapshot(self, name='bokeh_scatter'): html = notebook_div(self.plot) widget = shaoscript('html$N='+name) widget.value = html return widget
def snapshot(self, name='bokeh_scatter'): html = notebook_div(self.plot) widget = shaoscript('html$N=' + name) widget.value = html return widget