コード例 #1
0
ファイル: kungfu.py プロジェクト: HCsoft-RD/shaolin
 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
コード例 #2
0
    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
コード例 #3
0
ファイル: kungfu.py プロジェクト: HCsoft-RD/shaolin
 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
コード例 #4
0
    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
コード例 #5
0
    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]
コード例 #6
0
    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]
コード例 #7
0
ファイル: bokeh.py プロジェクト: HCsoft-RD/shaolin
 def snapshot(self, name='bokeh_scatter'):
   html =  notebook_div(self.plot)
   widget = shaoscript('html$N='+name)
   widget.value = html
   return widget
コード例 #8
0
ファイル: bokeh.py プロジェクト: vav1288/shaolin
 def snapshot(self, name='bokeh_scatter'):
     html = notebook_div(self.plot)
     widget = shaoscript('html$N=' + name)
     widget.value = html
     return widget