Beispiel #1
0
 def list_views(self, request):
     available = []
     mf = MakeFiguresNDP(None)
     for x in sorted(mf.available()): 
         data_formats = mf.available_formats(x)
         available.append((x, data_formats))
     return {
         'available': available,
          'navigation': self.get_navigation_links(request),
         }
Beispiel #2
0
 def __call__(self, data):
     ndp = get_ndp(data)
     library = data['library']
     mf = MakeFiguresNDP(ndp=ndp, library=library, yourname=None)
      
     formats = mf.available_formats(self.name)
     res = mf.get_figure(self.name, formats)
     
     results = [(_, self.name, res[_]) for _ in formats]
     return results
Beispiel #3
0
def figint01():
    ndp = parse_ndp("""
        mcdp {
        
        }
    """)
    mf = MakeFiguresNDP(ndp=ndp, library=None, yourname=None)

    for name in mf.available():
        formats = mf.available_formats(name)
        res = mf.get_figure(name, formats)
        print('%s -> %s %s ' % (name, formats, map(len, [res[f] for f in formats])))
Beispiel #4
0
def allformats_report(id_ndp, ndp, libname, which):
    from mcdp_web.images.images import get_mime_for_format
    r = Report(id_ndp + '-' + which)
    from mcdp_library_tests.tests import get_test_library
    library = get_test_library(libname)
    mf = MakeFiguresNDP(ndp=ndp, library=library, yourname=id_ndp)
    formats = mf.available_formats(which)
    try:
        res = mf.get_figure(which, formats)
    except DPSemanticError as e:
        if 'Cannot abstract' in str(e):
            r.text('warning', 'Not connected. \n\n %s' % e)
            return r
    print('%s -> %s %s ' % (which, formats, map(len, [res[f] for f in formats])))
    fig = r.figure()
    for f in formats:
        data = res[f]
        mime = get_mime_for_format(f)
        dn = DataNode(f, data=data, mime=mime)
        fig.add_child(dn)
    return r