Exemplo n.º 1
0
    def _repr_html_(self):
        from xmle import Elem
        xsign = Elem("div", {'class': 'larch_head_tag'})
        from .images import favicon
        p = xsign.elem('p', {'style': 'float:left;margin-top:6px'})
        p.elem('img', {
            'width': "32",
            'height': "32",
            'src': "data:image/png;base64,{}".format(favicon),
            'style': 'float:left;position:relative;top:-3px;padding-right:0.2em;'
        }, tail=f" {self.appname} ")
        p.elem('span', {'class': 'larch_head_tag_ver'}, text=f" {self.version} ")
        p.elem('span', {'class': 'larch_head_tag_pth'}, text=f" {self.path} ")
        from .images import camsyslogo_element
        xsign << camsyslogo_element
        if 'larch' in sys.modules:
            from .images import georgiatechlogo_element
            xsign << georgiatechlogo_element

        if self.extra:
            v = '\n│'.join(sys.version.split('\n'))
            xsign.elem('br')
            xinfo = xsign.elem('div', {'class': 'larch_head_tag_more', 'style':'margin-top:10px; padding:7px'}, text=f'Python {v}')
            xinfo.elem('br', tail=f"EXE - {sys.executable}")
            xinfo.elem('br', tail=f"CWD - {os.getcwd()}")
            xinfo.elem('br', tail=f"PATH - ")
            ul = xinfo.elem('ul', {'style': 'margin-top:0; margin-bottom:0;'})
            for p in sys.path:
                ul.elem('li', text=p)

        from ..util.styles import _default_css_jupyter, _tooltipped_style_css
        style_prefix = "<style>{}\n\n{}</style>\n".format(_default_css_jupyter, _tooltipped_style_css)

        return style_prefix+xsign.tostring()
Exemplo n.º 2
0
    def _repr_html_(self):
        from ..util.styles import _default_css_jupyter, _tooltipped_style_css
        style_prefix = "<style>{}\n\n{}</style>\n".format(
            _default_css_jupyter, _tooltipped_style_css)
        from xmle import Elem
        xsign = Elem("div", {'class': 'larch_head_tag'})
        from .images import favicon
        p = xsign.elem('p', {'style': 'float:left;margin-top:6px'})
        p.elem('img', {
            'width':
            "32",
            'height':
            "32",
            'src':
            "data:image/png;base64,{}".format(favicon),
            'style':
            'float:left;position:relative;top:-3px;padding-right:0.2em;'
        },
               tail=f" {self.appname} ")
        p.elem('span', {'class': 'larch_head_tag_ver'},
               text=f" {self.version} ")
        if not self.minimal:
            p.elem('span', {'class': 'larch_head_tag_pth'},
                   text=f" {self.path} ")
            from .images import camsyslogo_element
            xsign << camsyslogo_element
            if 'larch' in sys.modules:
                from .images import georgiatechlogo_element
                xsign << georgiatechlogo_element

            if self.extra:
                v = '\n│'.join(sys.version.split('\n'))
                xsign.elem('br')
                xinfo = xsign.elem('div', {
                    'class': 'larch_head_tag_more',
                    'style': 'margin-top:10px; padding:7px'
                },
                                   text=f'Python {v}')
                xinfo.elem('br', tail=f"EXE - {sys.executable}")
                xinfo.elem('br', tail=f"CWD - {os.getcwd()}")
                xinfo.elem('br', tail=f"PATH - ")
                ul = xinfo.elem('ul',
                                {'style': 'margin-top:0; margin-bottom:0;'})
                for p in sys.path:
                    ul.elem('li', text=p)

        return style_prefix + xsign.tostring()
Exemplo n.º 3
0
 def _repr_html_(self):
     from xmle import Elem
     x = Elem('div') << (self.__xml__())
     return x.tostring()