コード例 #1
0
ファイル: images.py プロジェクト: AndreaCensi/mcdp
 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),
         }
コード例 #2
0
ファイル: plot.py プロジェクト: AndreaCensi/mcdp
 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
コード例 #3
0
ファイル: main.py プロジェクト: AndreaCensi/mcdp
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])))
コード例 #4
0
ファイル: main.py プロジェクト: AndreaCensi/mcdp
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