diff --git a/waypoint_manager/scripts/manager_GUI.py b/waypoint_manager/scripts/manager_GUI.py index de51c17..0642163 100755 --- a/waypoint_manager/scripts/manager_GUI.py +++ b/waypoint_manager/scripts/manager_GUI.py @@ -522,9 +522,13 @@ txt_box = tk.Entry(self.wp_info_win, width=20, font=("Consolas", 15)) txt_box.insert(tk.END, str(point[key]).lower()) txt_box.grid(column=1, row=i, padx=2, pady=2, ipady=3, sticky=tk.EW) + # New parameter + new_param_btn = tk.Button(self.wp_info_win, text="New Parameter", bg="#AFA") + new_param_btn["command"] = self.new_param_btn_callback + new_param_btn.grid(column=0, columnspan=2, row=self.wp_info_win.grid_size()[1]) # Apply, DnD(Drag & Drop), remove ボタン canv = tk.Canvas(self.wp_info_win) - canv.grid(column=0, columnspan=2, row=self.wp_info_win.grid_size()[1], sticky=tk.EW) + canv.grid(column=0, columnspan=2, row=self.wp_info_win.grid_size()[1], sticky=tk.EW, pady=5) apply_btn = tk.Button(canv, text="Apply", width=5, height=1, bg="#FDD", command=self.apply_btn_callback) apply_btn.pack(side=tk.RIGHT, anchor=tk.SE, padx=5, pady=5) @@ -596,6 +600,40 @@ """ + +++++ New Parameter ボタンを押したときのコールバック +++++ + """ + def new_param_btn_callback(self): + # Sub window + sub_win = tk.Toplevel() + sub_win.title("Add new parameter") + sub_win.attributes('-topmost', True) + font = ("Consolas",15) + # Message label + label = tk.Label(sub_win, text="Name : Value", font=font, anchor=tk.CENTER, width=20) + label.grid(row=0, column=0, columnspan=3, padx=10, pady=10) + # Text box + name_entry = tk.Entry(sub_win, font=font, width=15) + name_entry.grid(column=0, row=1, padx=10, pady=5) + colon = tk.Label(sub_win, text=":", font=font, anchor=tk.CENTER, width=2) + colon.grid(row=1, column=1) + value_entry = tk.Entry(sub_win, font=font, width=15) + value_entry.grid(column=2, row=1, padx=10, pady=5) + # Buttons + add_btn = tk.Button(sub_win, text="Add", width=5, height=1, font=font, anchor=tk.CENTER) + add_btn.grid(column=2, row=2, pady=20) + cancel_btn = tk.Button(sub_win, text="Cancel", width=7, height=1, font=font, anchor=tk.CENTER) + cancel_btn.grid(column=0, row=2, pady=20) + # Window position + sub_win.update() + w = sub_win.winfo_width() + 10 + h = sub_win.winfo_height() + x = int((self.canv_w - w) / 2) + y = int((self.canv_h - h) / 2) + sub_win.geometry("{}x{}+{}+{}".format(w, h, x, y)) + return + + + """ +++++ ウェイポイント情報を表示するサブウィンドウを閉じたときのコールバック +++++ """ def close_wp_info(self):