コード例 #1
0
def adjustview():
    if request.method == "POST":
        dat = htsip.xmlsessread()
        dat["leng"] = request.form["len"]
        dat["wid"] = request.form["wid"]
        dat["img"] = request.form["img"]
        htsip.sessconfwrite(dat)
        confdat = htsip.confread(dat["file"])
        ti = str(time.time())
        mod = "n"
        if len(confdat["objlist"]) > 0:
            mod = "y"
        return render_template("gui.img.edit.html", dat=dat, confdat=confdat, act="adjustview", ti=ti, mod=mod)
コード例 #2
0
def modplot():
    if request.method == "POST":
        dat = htsip.xmlsessread()
        confdat = htsip.confread(dat["file"])
        cmd = request.form["but"]
        ti = str(time.time())
        mod = "n"
        if len(confdat["objlist"]) > 0:
            mod = "y"
        if cmd == "Plot Area":
            dat["img"] = "plotarea"
            htsip.sessconfwrite(dat)
            confdat = htsip.confread(dat["file"])
            return render_template("gui.img.edit.html", dat=dat, act="plotarea", confdat=confdat, ti=ti, mod=mod)
        if cmd == "Adjust View":
            confdat = htsip.confread(dat["file"])
            return render_template("gui.img.edit.html", dat=dat, confdat=confdat, act="adjustview", ti=ti, mod=mod)
        if cmd == "New Object":
            confdat = htsip.confread(dat["file"])
            return render_template("gui.img.edit.html", dat=dat, confdat=confdat, act="newobject", ti=ti, mod=mod)
        if cmd == "Modify Object":
            confdat = htsip.confread(dat["file"])
            return render_template(
                "gui.img.edit.html", dat=dat, confdat=confdat, act="modifyobject", mod=mod, objnumber=0
            )
        if cmd == "Plot Head":
            dat["img"] = "plotarea"
            htsip.sessconfwrite(dat)
            confdat = htsip.confread(dat["file"])
            return render_template("gui.img.edit.html", dat=dat, act="plothead", confdat=confdat, ti=ti, mod=mod)
        if cmd == "Assemble Gcode":
            confdat = htsip.confread(dat["file"])
            f = open("templates/gui.tmp.txt", "w")
            f.write(json.dumps(confdat))
            f.close()
            return render_template(
                "gui.img.edit.html", dat=dat, confdat=confdat, act="assemblegcode", mod=mod, objnumber=0
            )
コード例 #3
0
def plotarea():
    if request.method == "POST":
        dat = htsip.xmlsessread()
        confdat = htsip.confread(dat["file"])
        # Plot area dimensions
        if len(request.form["len"]) > 0:
            confdat["deck"]["plx"] = float(request.form["len"])
        if len(request.form["wid"]) > 0:
            confdat["deck"]["ply"] = float(request.form["wid"])
        dat["displothead"] = int(request.form["displothead"])
        dat["disobjs"] = int(request.form["disobjs"])
        # Display plothead position
        if len(request.form["pxpos"]) > 0:
            dat["pxpos"] = request.form["pxpos"]
        if len(request.form["pypos"]) > 0:
            dat["pypos"] = request.form["pypos"]
        htsip.sessconfwrite(dat)
        htsip.confwrite(dat["file"], confdat)
        ti = str(time.time())
        mod = "n"
        if len(confdat["objlist"]) > 0:
            mod = "y"
        return render_template("gui.img.edit.html", dat=dat, act="plotarea", confdat=confdat, ti=ti, mod=mod)
コード例 #4
0
def plothead():
    if request.method == "POST":
        dat = htsip.xmlsessread()
        confdat = htsip.confread(dat["file"])
        if len(request.form["len"]) > 0:
            confdat["plothead"]["x"] = request.form["len"]
        if len(request.form["wid"]) > 0:
            confdat["plothead"]["y"] = request.form["wid"]
        if len(request.form["posx"]) > 0:
            confdat["plothead"]["posx"] = request.form["posx"]
        if len(request.form["posy"]) > 0:
            confdat["plothead"]["posy"] = request.form["posy"]
        if len(request.form["xsp"]) > 0:
            confdat["plothead"]["xsp"] = request.form["xsp"]
        if len(request.form["ysp"]) > 0:
            confdat["plothead"]["ysp"] = request.form["ysp"]
        if len(request.form["tipx"]) > 0:
            confdat["plothead"]["tipx"] = float(request.form["tipx"])
        if len(request.form["tipy"]) > 0:
            confdat["plothead"]["tipy"] = float(request.form["tipy"])
        if len(request.form["reftip"]) > 0:
            confdat["plothead"]["reftip"] = int(request.form["reftip"])
        if len(request.form["camx"]) > 0:
            confdat["plothead"]["camx"] = request.form["camx"]
        if len(request.form["camy"]) > 0:
            confdat["plothead"]["camy"] = request.form["camy"]
        if len(request.form["camdiam"]) > 0:
            confdat["plothead"]["camdiam"] = request.form["camdiam"]
        dat["img"] = request.form["img"]
        htsip.sessconfwrite(dat)
        htsip.confwrite(dat["file"], confdat)
        ti = str(time.time())
        mod = "n"
        if len(confdat["objlist"]) > 0:
            mod = "y"
        return render_template("gui.img.edit.html", dat=dat, act="plothead", confdat=confdat, ti=ti, mod=mod)