Exemple #1
0
def view(*a, **k):
    d = system.__dict__

    lib_path = system.lib_path
    instance_path = system.instance_path
    site_path = system.config.site_path
    theme_path = system.themes_path
    app_paths = manager.app_paths
    status = status_info()

    return page(markdown("""
Paths
----
<pre>
lib_path......: %(lib_path)s
instance_path.: %(instance_path)s
site_path.....: %(site_path)s
theme_path....: %(theme_path)s
app_path......: %(app_paths)s
</pre>

Context
----
%(status)s
    """) % locals(), title='Overview')
Exemple #2
0
def load_document(name, args={}):
    filename = 'docs/{}.md'.format(name)
    feature, messages, body = '', '', ''
    if os.path.exists(filename):
        body = markdown(load(filename).format(**args))
        if BREAKER in body:
            parts = body.split(BREAKER)
            if len(parts) == 3:
                feature, messages, body = parts
            elif len(parts) == 2:
                feature, body = parts
    return feature, messages, body
Exemple #3
0
def load_document(name, args={}):
    filename = 'docs/{}.md'.format(name)
    feature, messages, body = '', '', ''
    if os.path.exists(filename):
        body = markdown(load(filename).format(**args))
        if BREAKER in body:
            parts = body.split(BREAKER)
            if len(parts) == 3:
                feature, messages, body = parts
            elif len(parts) == 2:
                feature, body = parts
    return feature, messages, body
Exemple #4
0
    def __call__(self, vis=None):
        system.app.menu.append('Data Visualization')
        if vis:
            method = getattr(self, vis.replace('-','_'))
            result = method()
            result['side_panel'] = markdown(toc)
            result['doc'] = method.__doc__
            result['code'] = get_code(method)
            result['data'] = ''
            return page(tpl, callback=result.get, css=css)

        else:
            return self.index()
Exemple #5
0
    def __call__(self, vis=None):
        system.app.menu.append('Data Visualization')
        if vis:
            method = getattr(self, vis.replace('-', '_'))
            result = method()
            result['side_panel'] = markdown(toc)
            result['doc'] = method.__doc__
            result['code'] = get_code(method)
            result['data'] = ''
            return page(tpl, callback=result.get, css=css)

        else:
            return self.index()
Exemple #6
0
 def index(self):
     def get_title(method):
         code = getsource(method)
         title = method.__doc__.splitlines()[0]
         return title
     thumbnails = []
     for name, method in getmembers(self, predicate=ismethod):
         if not name.startswith('_') and not name in ['index', 'show']:
             link = link_to(get_title(method), name)
             thumbnails.append(method()['visualization'])
     content = ul(div(t, Class='thumbnail') for t in thumbnails)
     return page(
         div(
             div(
                 markdown(toc),
                 Class="col-md-3",
             ) + div(
                 content,
                 Class="col-md-9 thumbnails",
             ),
             Class='row',
         ), css=css)
Exemple #7
0
    def index(self):
        def get_title(method):
            code = getsource(method)
            title = method.__doc__.splitlines()[0]
            return title

        thumbnails = []
        for name, method in getmembers(self, predicate=ismethod):
            if not name.startswith('_') and not name in ['index', 'show']:
                link = link_to(get_title(method), name)
                thumbnails.append(method()['visualization'])
        content = ul(div(t, Class='thumbnail') for t in thumbnails)
        return page(div(
            div(
                markdown(toc),
                Class="col-md-3",
            ) + div(
                content,
                Class="col-md-9 thumbnails",
            ),
            Class='row',
        ),
                    css=css)
Exemple #8
0
def get_code(method):
    source = getsource(method)
    lines = [l[4:] for l in source.splitlines()[1:-1]]
    selection = '\n'.join(lines)
    return markdown(selection)
Exemple #9
0
def get_code(method):
    source = getsource(method)
    lines = [l[4:] for l in source.splitlines()[1:-1]]
    selection = '\n'.join(lines)
    return markdown(selection)