pygui: updates to leverage tk provided constants for sticky configuration, instead of duplicate strings everywhere

This commit is contained in:
Blake Harnden 2020-08-02 10:36:14 -07:00
parent 2aeb119b04
commit f0bc3bbc99
40 changed files with 501 additions and 496 deletions

View file

@ -38,56 +38,56 @@ class RunToolDialog(Dialog):
def draw_command_frame(self) -> None:
# the main frame
frame = ttk.Frame(self.top)
frame.grid(row=0, column=0, sticky="nsew", padx=PADX)
frame.grid(row=0, column=0, sticky=tk.NSEW, padx=PADX)
frame.columnconfigure(0, weight=1)
frame.rowconfigure(1, weight=1)
labeled_frame = ttk.LabelFrame(frame, text="Command", padding=FRAME_PAD)
labeled_frame.grid(sticky="ew", pady=PADY)
labeled_frame.grid(sticky=tk.EW, pady=PADY)
labeled_frame.rowconfigure(0, weight=1)
labeled_frame.columnconfigure(0, weight=1)
entry = ttk.Entry(labeled_frame, textvariable=self.cmd)
entry.grid(sticky="ew")
entry.grid(sticky=tk.EW)
# results frame
labeled_frame = ttk.LabelFrame(frame, text="Output", padding=FRAME_PAD)
labeled_frame.grid(sticky="nsew", pady=PADY)
labeled_frame.grid(sticky=tk.NSEW, pady=PADY)
labeled_frame.columnconfigure(0, weight=1)
labeled_frame.rowconfigure(0, weight=1)
self.result = CodeText(labeled_frame)
self.result.text.config(state=tk.DISABLED, height=15)
self.result.grid(sticky="nsew", pady=PADY)
self.result.grid(sticky=tk.NSEW, pady=PADY)
button_frame = ttk.Frame(labeled_frame)
button_frame.grid(sticky="nsew")
button_frame.grid(sticky=tk.NSEW)
button_frame.columnconfigure(0, weight=1)
button_frame.columnconfigure(1, weight=1)
button = ttk.Button(button_frame, text="Run", command=self.click_run)
button.grid(sticky="ew", padx=PADX)
button.grid(sticky=tk.EW, padx=PADX)
button = ttk.Button(button_frame, text="Close", command=self.destroy)
button.grid(row=0, column=1, sticky="ew")
button.grid(row=0, column=1, sticky=tk.EW)
def draw_nodes_frame(self) -> None:
labeled_frame = ttk.LabelFrame(self.top, text="Nodes", padding=FRAME_PAD)
labeled_frame.grid(row=0, column=1, sticky="nsew")
labeled_frame.grid(row=0, column=1, sticky=tk.NSEW)
labeled_frame.columnconfigure(0, weight=1)
labeled_frame.rowconfigure(0, weight=1)
self.node_list = ListboxScroll(labeled_frame)
self.node_list.listbox.config(selectmode=tk.MULTIPLE)
self.node_list.grid(sticky="nsew", pady=PADY)
self.node_list.grid(sticky=tk.NSEW, pady=PADY)
for n in sorted(self.executable_nodes.keys()):
self.node_list.listbox.insert(tk.END, n)
button_frame = ttk.Frame(labeled_frame, padding=FRAME_PAD)
button_frame.grid(sticky="nsew")
button_frame.grid(sticky=tk.NSEW)
button_frame.columnconfigure(0, weight=1)
button_frame.columnconfigure(1, weight=1)
button = ttk.Button(button_frame, text="All", command=self.click_all)
button.grid(sticky="nsew", padx=PADX)
button.grid(sticky=tk.NSEW, padx=PADX)
button = ttk.Button(button_frame, text="None", command=self.click_none)
button.grid(row=0, column=1, sticky="nsew")
button.grid(row=0, column=1, sticky=tk.NSEW)
def click_all(self) -> None:
self.node_list.listbox.selection_set(0, self.node_list.listbox.size() - 1)