Esempio n. 1
0
def cb_save_as():
    global RecipeName, msgBox, msgBoxWait
    if wRecipe is None: return
    if msgBoxWait is not None: return
    msgBox = tk.Toplevel()
    msgBox.title("Save Recipe as")
    msgBox.withdraw()
    msgBoxWait = msgBox.after(1000, cb_wait_nop)
    ret = asksaveasfilename(parent=root,
                            defaultext="",
                            initialdir=dirpath,
                            initialfile="",
                            filetypes=[("Directory", "*/")])
    msgBox.after_cancel(msgBoxWait)
    msgBoxWait = None
    msgBox.destroy()
    if ret != "":
        dir = re.sub(r".*" + Config["recipe"]["dir"], "", ret)
        recipe = dir.replace("/", "")
        commands.getoutput("cp -a " + dirpath + "/" + RecipeName + " " +
                           dirpath + "/" + recipe)
        RecipeName = recipe
        Param["recipe"] = RecipeName
        rospy.set_param("/dashboard", Param)
        wRecipe.delete(0, tk.END)
        wRecipe.insert(0, Param["recipe"])
        commands.getoutput("rm " + linkpath + ";ln -s " + dirpath + "/" +
                           RecipeName + " " + linkpath)
Esempio n. 2
0
def cb_save_as():
    global msgBox, msgBoxWait
    if msgBoxWait is not None: return
    msgBox = tk.Tk()
    msgBox.title("Save Recipe as")
    msgBoxWait = msgBox.after(Config["autoclose"] * 1000, cb_autoclose)
    ret = asksaveasfilename(parent=msgBox,
                            defaultext="",
                            initialdir=dirpath,
                            initialfile="",
                            filetypes=[("Directory", "*/")])
    if msgBoxWait is None: return  #returned by autoclose
    msgBox.after_cancel(msgBoxWait)
    msgBoxWait = None
    msgBox.destroy()
    if ret != "":
        dir = re.sub(r".*" + Config["recipe"]["dir"], "", ret)
        recipe = dir.replace("/", "")
        commands.getoutput("cp -a " + dirpath + "/" + Param["recipe"] + " " +
                           dirpath + "/" + recipe)
        Param["recipe"] = recipe
        wRecipe.delete(0, tk.END)
        wRecipe.insert(0, Param["recipe"])
        commands.getoutput("rm " + linkpath + ";ln -s " + dirpath + "/" +
                           Param["recipe"] + " " + linkpath)
Esempio n. 3
0
def cb_save_as(n):
    global massage
    func_ret = False
    name = buttons[n]["name"]
    ret = asksaveasfilename(parent=root,
                            title=name,
                            defaultext='',
                            initialdir=dirpath,
                            initialfile='',
                            filetypes=[('Directory', '*/')],
                            okbuttontext='Ok')
    if ret:
        recipe = ret.split('/')
        if recipe[-1]:
            func_ret = set_recipe(recipe[-1], n)
        else:
            massage = name + ' RecipeName Empty'
    return func_ret