示例#1
0
 def list_views(self, e):  # @UnusedVariable
     available = []
     mf = MakeFiguresNDP(None)
     for x in sorted(mf.available()): 
         data_formats = mf.available_formats(x)
         available.append((x, data_formats))
     return {
         'available': available,
     } 
示例#2
0
文件: plot.py 项目: kannode/mcdp
    def __call__(self, data):
        ndp = get_ndp(data)
        library = data['library']
        paths = library.get_images_paths()
        image_source = ImagesFromPaths(paths)
        mf = MakeFiguresNDP(ndp=ndp, image_source=image_source, 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
def figint01():
    ndp = parse_ndp("""
        mcdp {
        
        }
    """)
    mf = MakeFiguresNDP(ndp=ndp, image_source=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
def allformats_report(id_ndp, ndp, libname, which):
    from mcdp_web.images.images import get_mime_for_format
    from mcdp_library_tests.tests import get_test_library
    r = Report(id_ndp + '-' + which)
    library = get_test_library(libname)
    image_source = ImagesFromPaths(library.get_images_paths())
    mf = MakeFiguresNDP(ndp=ndp, image_source=image_source, 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