Skip to content

Commit

Permalink
removed unneeded backend code added during import/export development
Browse files Browse the repository at this point in the history
  • Loading branch information
William-Hill committed Nov 7, 2018
1 parent 9e6115b commit f8a65f1
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 30 deletions.
21 changes: 0 additions & 21 deletions backend/vcdat/Colormaps.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import vcs
import json


def get_cmaps():
Expand All @@ -8,23 +7,3 @@ def get_cmaps():
index = vcs.getcolormap(cmap).index
cmaps[cmap] = [vcs.getcolormap(cmap).getcolorcell(i) for i in range(256)]
return cmaps



def export_colormap(colormap_name , file_path="/tmp/test_export"):
if colormap_name in vcs.listelements('colormap'):
output = vcs.getcolormap(colormap_name)
try:
output.script(file_path, "w")
except:
raise
else:
return "Exported colormap {} to {}".format(colormap_name, file_path)


def import_colormap(colormap_name, file_path):
with open(file_path, 'r') as fd:
jsonObj = json.loads(fd.read())

myColorMap = vcs.createcolormap()
myColorMap.index = jsonObj['Cp']['default']['index']
10 changes: 1 addition & 9 deletions backend/vcdat/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from flask import Flask, send_from_directory, request, send_file, Response, jsonify
from Templates import templ_from_json
from Files import getFilesObject
from Colormaps import get_cmaps, export_colormap
from Colormaps import get_cmaps
import weakref
import functools

Expand Down Expand Up @@ -131,18 +131,10 @@ def get_default_methods():
@app.route("/getColormaps")
@jsonresp
def get_colormaps():
print("inside get_colormaps")
colormaps = get_cmaps()
return json.dumps(colormaps)


@app.route("/exportColormap")
def colormap_export():
print("request:", request.args)
print("inside colormap_export")
colormap_name = request.args.get('colormap_name', None)
return export_colormap(colormap_name)

@app.route("/getInitialFileTree")
def get_initial_file_tree():
start_path = os.path.expanduser('~')
Expand Down

0 comments on commit f8a65f1

Please sign in to comment.