def menu(): dat = htsip.xmlsessread() confdat = htsip.confread(dat["file"]) cmd = request.form["but"] if cmd == "Delete": os.rename("jsfiles/" + dat["file"], "delfiles/del" + dat["file"]) htsip.xmlsessload("") dat = htsip.xmlsessread() return render_template("gui.init.html", condat=dat)
def gfile(): if request.method == "POST": file = request.files["datafile"] print file.filename htsip.xmlsessload(file.filename) dat = htsip.xmlsessread() if file and allowed_file(file.filename): filename = secure_filename(file.filename) print filename file.save(os.path.join(app.config["UPLOAD_FOLDER"], filename)) dat = htsip.xmlsessread() return render_template("gui.init.html", condat=dat)
def confsel(): filen = request.form["filen"] acti = request.form["act"] htsip.xmlsessload(filen) dat = htsip.xmlsessread() confdat = htsip.confread(dat["file"]) if len(confdat["objlist"]) == 0: pg = "plotarea" mod = "n" else: pg = "newobject" mod = "y" if acti == "Load": return render_template("gui.img.edit.html", dat=dat, confdat=confdat, act=pg, mod=mod) if acti == "Download": f = open("templates/gui.tmp.txt", "w") f.write(json.dumps(confdat)) f.close() return render_template("gui.tmp.html", dat=dat)
def confnew(): if request.method == "POST": filen = request.form["filen"] dat = htsip.xmlsessread() err = "n" # here i need to figure out a way to check directory so its wrong for i in dat["files"]: print i if filen == i: err = "y" if err == "y": return "This file already exists" else: fl = open("jsfiles/" + filen + ".txt", "w") stdat = '{"plothead": {"reftip": 11, "camy": "25", "camx": "15", "camdiam": "30", "xsp": "4.5", "tipy": 5, "tipx": 3, "posx": "10", "posy": "100", "y": "150", "x": "100", "ysp": "4.5"},"deck": {"ply": 600.0, "plx": 600.0},"objlist":[]}' fl.write(stdat) fl.close() htsip.xmlsessload(filen) dat = htsip.xmlsessread() confdat = htsip.confread(dat["file"]) return render_template("gui.img.edit.html", dat=dat, confdat=confdat, act="newobject", mod="n")