コード例 #1
0
ファイル: app.py プロジェクト: vsoch/visci
def generate_vis_index(vis_files,base_dir):
    template = get_template("index")
    # For each vis file, generate link to it
    visci_select = ""
    for vis_file in vis_files:
        relative_path = vis_file.replace(base_dir,"")
        if relative_path[0] == "/":
            relative_path = relative_path[1:]  
        visci_select = '\n%s<option value="%s">%s</option>' %(visci_select,relative_path,relative_path)
    substitutions = {"VISCI_SELECT":visci_select,
                     "VISUALIZATION_ONE":relative_path}
    template = sub_template(template,substitutions)
    save_render(template,"%s/index.html" %base_dir)
コード例 #2
0
ファイル: app.py プロジェクト: vsoch/visci
def generate_vis_index(vis_files, base_dir):
    template = get_template("index")
    # For each vis file, generate link to it
    visci_select = ""
    for vis_file in vis_files:
        relative_path = vis_file.replace(base_dir, "")
        if relative_path[0] == "/":
            relative_path = relative_path[1:]
        visci_select = '\n%s<option value="%s">%s</option>' % (
            visci_select, relative_path, relative_path)
    substitutions = {
        "VISCI_SELECT": visci_select,
        "VISUALIZATION_ONE": relative_path
    }
    template = sub_template(template, substitutions)
    save_render(template, "%s/index.html" % base_dir)
コード例 #3
0
ファイル: app.py プロジェクト: vsoch/visci
def generate_vis(template_file,data_files,output_folder):
    # We will save a list of the output files
    visualization_files = []
    template = read_template(template_file)  
    for data_file in data_files:
        try:
            relative_path = data_file.replace(output_folder,"") 
            if relative_path[0] == "/":
                relative_path = relative_path[1:]  
            filename = os.path.basename(data_file).split(".")[0]
            sub = sub_template(template,{"DATA":relative_path})
            vis_file = "%s/%s.html" %(output_folder,filename)
            save_render(sub,vis_file)
            visualization_files.append(vis_file)
        except:
            print "Error with file %s. Skipping." %(data_file)

    return visualization_files
コード例 #4
0
ファイル: app.py プロジェクト: vsoch/visci
def generate_vis(template_file, data_files, output_folder):
    # We will save a list of the output files
    visualization_files = []
    template = read_template(template_file)
    for data_file in data_files:
        try:
            relative_path = data_file.replace(output_folder, "")
            if relative_path[0] == "/":
                relative_path = relative_path[1:]
            filename = os.path.basename(data_file).split(".")[0]
            sub = sub_template(template, {"DATA": relative_path})
            vis_file = "%s/%s.html" % (output_folder, filename)
            save_render(sub, vis_file)
            visualization_files.append(vis_file)
        except:
            print "Error with file %s. Skipping." % (data_file)

    return visualization_files