pygui: updates to leverage tk provided constants for sticky configuration, instead of duplicate strings everywhere
This commit is contained in:
parent
2aeb119b04
commit
f0bc3bbc99
40 changed files with 501 additions and 496 deletions
|
@ -34,7 +34,7 @@ class IpConfigDialog(Dialog):
|
|||
frame.columnconfigure(0, weight=1)
|
||||
frame.columnconfigure(1, weight=1)
|
||||
frame.rowconfigure(0, weight=1)
|
||||
frame.grid(sticky="nsew", pady=PADY)
|
||||
frame.grid(sticky=tk.NSEW, pady=PADY)
|
||||
|
||||
ip4_frame = ttk.LabelFrame(frame, text="IPv4", padding=FRAME_PAD)
|
||||
ip4_frame.columnconfigure(0, weight=1)
|
||||
|
@ -42,23 +42,23 @@ class IpConfigDialog(Dialog):
|
|||
ip4_frame.grid(row=0, column=0, stick="nsew")
|
||||
self.ip4_listbox = ListboxScroll(ip4_frame)
|
||||
self.ip4_listbox.listbox.bind("<<ListboxSelect>>", self.select_ip4)
|
||||
self.ip4_listbox.grid(sticky="nsew", pady=PADY)
|
||||
self.ip4_listbox.grid(sticky=tk.NSEW, pady=PADY)
|
||||
for index, ip4 in enumerate(self.ip4s):
|
||||
self.ip4_listbox.listbox.insert(tk.END, ip4)
|
||||
if self.ip4 == ip4:
|
||||
self.ip4_listbox.listbox.select_set(index)
|
||||
self.ip4_entry = ttk.Entry(ip4_frame)
|
||||
self.ip4_entry.grid(sticky="ew", pady=PADY)
|
||||
self.ip4_entry.grid(sticky=tk.EW, pady=PADY)
|
||||
ip4_button_frame = ttk.Frame(ip4_frame)
|
||||
ip4_button_frame.columnconfigure(0, weight=1)
|
||||
ip4_button_frame.columnconfigure(1, weight=1)
|
||||
ip4_button_frame.grid(sticky="ew")
|
||||
ip4_button_frame.grid(sticky=tk.EW)
|
||||
ip4_add = ttk.Button(ip4_button_frame, text="Add", command=self.click_add_ip4)
|
||||
ip4_add.grid(row=0, column=0, sticky="ew")
|
||||
ip4_add.grid(row=0, column=0, sticky=tk.EW)
|
||||
ip4_del = ttk.Button(
|
||||
ip4_button_frame, text="Delete", command=self.click_del_ip4
|
||||
)
|
||||
ip4_del.grid(row=0, column=1, sticky="ew")
|
||||
ip4_del.grid(row=0, column=1, sticky=tk.EW)
|
||||
|
||||
ip6_frame = ttk.LabelFrame(frame, text="IPv6", padding=FRAME_PAD)
|
||||
ip6_frame.columnconfigure(0, weight=1)
|
||||
|
@ -66,23 +66,23 @@ class IpConfigDialog(Dialog):
|
|||
ip6_frame.grid(row=0, column=1, stick="nsew")
|
||||
self.ip6_listbox = ListboxScroll(ip6_frame)
|
||||
self.ip6_listbox.listbox.bind("<<ListboxSelect>>", self.select_ip6)
|
||||
self.ip6_listbox.grid(sticky="nsew", pady=PADY)
|
||||
self.ip6_listbox.grid(sticky=tk.NSEW, pady=PADY)
|
||||
for index, ip6 in enumerate(self.ip6s):
|
||||
self.ip6_listbox.listbox.insert(tk.END, ip6)
|
||||
if self.ip6 == ip6:
|
||||
self.ip6_listbox.listbox.select_set(index)
|
||||
self.ip6_entry = ttk.Entry(ip6_frame)
|
||||
self.ip6_entry.grid(sticky="ew", pady=PADY)
|
||||
self.ip6_entry.grid(sticky=tk.EW, pady=PADY)
|
||||
ip6_button_frame = ttk.Frame(ip6_frame)
|
||||
ip6_button_frame.columnconfigure(0, weight=1)
|
||||
ip6_button_frame.columnconfigure(1, weight=1)
|
||||
ip6_button_frame.grid(sticky="ew")
|
||||
ip6_button_frame.grid(sticky=tk.EW)
|
||||
ip6_add = ttk.Button(ip6_button_frame, text="Add", command=self.click_add_ip6)
|
||||
ip6_add.grid(row=0, column=0, sticky="ew")
|
||||
ip6_add.grid(row=0, column=0, sticky=tk.EW)
|
||||
ip6_del = ttk.Button(
|
||||
ip6_button_frame, text="Delete", command=self.click_del_ip6
|
||||
)
|
||||
ip6_del.grid(row=0, column=1, sticky="ew")
|
||||
ip6_del.grid(row=0, column=1, sticky=tk.EW)
|
||||
|
||||
# draw buttons
|
||||
frame = ttk.Frame(self.top)
|
||||
|
@ -90,9 +90,9 @@ class IpConfigDialog(Dialog):
|
|||
for i in range(2):
|
||||
frame.columnconfigure(i, weight=1)
|
||||
button = ttk.Button(frame, text="Save", command=self.click_save)
|
||||
button.grid(row=0, column=0, sticky="ew", padx=PADX)
|
||||
button.grid(row=0, column=0, sticky=tk.EW, padx=PADX)
|
||||
button = ttk.Button(frame, text="Cancel", command=self.destroy)
|
||||
button.grid(row=0, column=1, sticky="ew")
|
||||
button.grid(row=0, column=1, sticky=tk.EW)
|
||||
|
||||
def click_add_ip4(self) -> None:
|
||||
ip4 = self.ip4_entry.get()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue