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
|
@ -111,13 +111,13 @@ class Application(ttk.Frame):
|
|||
self.master.columnconfigure(0, weight=1)
|
||||
self.rowconfigure(0, weight=1)
|
||||
self.columnconfigure(1, weight=1)
|
||||
self.grid(sticky="nsew")
|
||||
self.grid(sticky=tk.NSEW)
|
||||
self.toolbar = Toolbar(self)
|
||||
self.toolbar.grid(sticky="ns")
|
||||
self.toolbar.grid(sticky=tk.NS)
|
||||
self.right_frame = ttk.Frame(self)
|
||||
self.right_frame.columnconfigure(0, weight=1)
|
||||
self.right_frame.rowconfigure(0, weight=1)
|
||||
self.right_frame.grid(row=0, column=1, sticky="nsew")
|
||||
self.right_frame.grid(row=0, column=1, sticky=tk.NSEW)
|
||||
self.draw_canvas()
|
||||
self.draw_infobar()
|
||||
self.draw_status()
|
||||
|
@ -139,21 +139,21 @@ class Application(ttk.Frame):
|
|||
canvas_frame = ttk.Frame(self.right_frame)
|
||||
canvas_frame.rowconfigure(0, weight=1)
|
||||
canvas_frame.columnconfigure(0, weight=1)
|
||||
canvas_frame.grid(row=0, column=0, sticky="nsew", pady=1)
|
||||
canvas_frame.grid(row=0, column=0, sticky=tk.NSEW, pady=1)
|
||||
self.canvas = CanvasGraph(canvas_frame, self, self.core)
|
||||
self.canvas.grid(sticky="nsew")
|
||||
self.canvas.grid(sticky=tk.NSEW)
|
||||
scroll_y = ttk.Scrollbar(canvas_frame, command=self.canvas.yview)
|
||||
scroll_y.grid(row=0, column=1, sticky="ns")
|
||||
scroll_y.grid(row=0, column=1, sticky=tk.NS)
|
||||
scroll_x = ttk.Scrollbar(
|
||||
canvas_frame, orient=tk.HORIZONTAL, command=self.canvas.xview
|
||||
)
|
||||
scroll_x.grid(row=1, column=0, sticky="ew")
|
||||
scroll_x.grid(row=1, column=0, sticky=tk.EW)
|
||||
self.canvas.configure(xscrollcommand=scroll_x.set)
|
||||
self.canvas.configure(yscrollcommand=scroll_y.set)
|
||||
|
||||
def draw_status(self) -> None:
|
||||
self.statusbar = StatusBar(self.right_frame, self)
|
||||
self.statusbar.grid(sticky="ew", columnspan=2)
|
||||
self.statusbar.grid(sticky=tk.EW, columnspan=2)
|
||||
|
||||
def display_info(self, frame_class: Type[InfoFrameBase], **kwargs: Any) -> None:
|
||||
if not self.show_infobar.get():
|
||||
|
@ -161,7 +161,7 @@ class Application(ttk.Frame):
|
|||
self.clear_info()
|
||||
self.info_frame = frame_class(self.infobar, **kwargs)
|
||||
self.info_frame.draw()
|
||||
self.info_frame.grid(sticky="nsew")
|
||||
self.info_frame.grid(sticky=tk.NSEW)
|
||||
|
||||
def clear_info(self) -> None:
|
||||
if self.info_frame:
|
||||
|
@ -174,7 +174,7 @@ class Application(ttk.Frame):
|
|||
|
||||
def show_info(self) -> None:
|
||||
self.default_info()
|
||||
self.infobar.grid(row=0, column=1, sticky="nsew")
|
||||
self.infobar.grid(row=0, column=1, sticky=tk.NSEW)
|
||||
|
||||
def hide_info(self) -> None:
|
||||
self.infobar.grid_forget()
|
||||
|
|
|
@ -46,9 +46,9 @@ class AboutDialog(Dialog):
|
|||
codetext = CodeText(self.top)
|
||||
codetext.text.insert("1.0", LICENSE)
|
||||
codetext.text.config(state=tk.DISABLED)
|
||||
codetext.grid(sticky="nsew")
|
||||
codetext.grid(sticky=tk.NSEW)
|
||||
|
||||
label = ttk.Label(
|
||||
self.top, text="Icons from https://icons8.com", anchor=tk.CENTER
|
||||
)
|
||||
label.grid(sticky="ew")
|
||||
label.grid(sticky=tk.EW)
|
||||
|
|
|
@ -30,13 +30,13 @@ class AlertsDialog(Dialog):
|
|||
frame = ttk.Frame(self.top)
|
||||
frame.columnconfigure(0, weight=1)
|
||||
frame.rowconfigure(0, weight=1)
|
||||
frame.grid(sticky="nsew", pady=PADY)
|
||||
frame.grid(sticky=tk.NSEW, pady=PADY)
|
||||
self.tree = ttk.Treeview(
|
||||
frame,
|
||||
columns=("time", "level", "session_id", "node", "source"),
|
||||
show="headings",
|
||||
)
|
||||
self.tree.grid(row=0, column=0, sticky="nsew")
|
||||
self.tree.grid(row=0, column=0, sticky=tk.NSEW)
|
||||
self.tree.column("time", stretch=tk.YES)
|
||||
self.tree.heading("time", text="Time")
|
||||
self.tree.column("level", stretch=tk.YES, width=100)
|
||||
|
@ -77,25 +77,25 @@ class AlertsDialog(Dialog):
|
|||
self.tree.tag_configure(notice_name, background="#85e085")
|
||||
|
||||
yscrollbar = ttk.Scrollbar(frame, orient="vertical", command=self.tree.yview)
|
||||
yscrollbar.grid(row=0, column=1, sticky="ns")
|
||||
yscrollbar.grid(row=0, column=1, sticky=tk.NS)
|
||||
self.tree.configure(yscrollcommand=yscrollbar.set)
|
||||
|
||||
xscrollbar = ttk.Scrollbar(frame, orient="horizontal", command=self.tree.xview)
|
||||
xscrollbar.grid(row=1, sticky="ew")
|
||||
xscrollbar.grid(row=1, sticky=tk.EW)
|
||||
self.tree.configure(xscrollcommand=xscrollbar.set)
|
||||
|
||||
self.codetext = CodeText(self.top)
|
||||
self.codetext.text.config(state=tk.DISABLED, height=11)
|
||||
self.codetext.grid(sticky="nsew", pady=PADY)
|
||||
self.codetext.grid(sticky=tk.NSEW, pady=PADY)
|
||||
|
||||
frame = ttk.Frame(self.top)
|
||||
frame.grid(sticky="ew")
|
||||
frame.grid(sticky=tk.EW)
|
||||
frame.columnconfigure(0, weight=1)
|
||||
frame.columnconfigure(1, weight=1)
|
||||
button = ttk.Button(frame, text="Reset", command=self.reset_alerts)
|
||||
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="Close", command=self.destroy)
|
||||
button.grid(row=0, column=1, sticky="ew")
|
||||
button.grid(row=0, column=1, sticky=tk.EW)
|
||||
|
||||
def reset_alerts(self) -> None:
|
||||
self.codetext.text.config(state=tk.NORMAL)
|
||||
|
|
|
@ -23,7 +23,7 @@ class SizeAndScaleDialog(Dialog):
|
|||
"""
|
||||
super().__init__(app, "Canvas Size and Scale")
|
||||
self.canvas: CanvasGraph = self.app.canvas
|
||||
self.section_font: font.Font = font.Font(weight="bold")
|
||||
self.section_font: font.Font = font.Font(weight=font.BOLD)
|
||||
width, height = self.canvas.current_dimensions
|
||||
self.pixel_width: tk.IntVar = tk.IntVar(value=width)
|
||||
self.pixel_height: tk.IntVar = tk.IntVar(value=height)
|
||||
|
@ -54,68 +54,68 @@ class SizeAndScaleDialog(Dialog):
|
|||
|
||||
def draw_size(self) -> None:
|
||||
label_frame = ttk.Labelframe(self.top, text="Size", padding=FRAME_PAD)
|
||||
label_frame.grid(sticky="ew")
|
||||
label_frame.grid(sticky=tk.EW)
|
||||
label_frame.columnconfigure(0, weight=1)
|
||||
|
||||
# draw size row 1
|
||||
frame = ttk.Frame(label_frame)
|
||||
frame.grid(sticky="ew", pady=PADY)
|
||||
frame.grid(sticky=tk.EW, pady=PADY)
|
||||
frame.columnconfigure(1, weight=1)
|
||||
frame.columnconfigure(3, weight=1)
|
||||
label = ttk.Label(frame, text="Width")
|
||||
label.grid(row=0, column=0, sticky="w", padx=PADX)
|
||||
label.grid(row=0, column=0, sticky=tk.W, padx=PADX)
|
||||
entry = validation.PositiveIntEntry(frame, textvariable=self.pixel_width)
|
||||
entry.grid(row=0, column=1, sticky="ew", padx=PADX)
|
||||
entry.grid(row=0, column=1, sticky=tk.EW, padx=PADX)
|
||||
entry.bind("<KeyRelease>", self.size_scale_keyup)
|
||||
label = ttk.Label(frame, text="x Height")
|
||||
label.grid(row=0, column=2, sticky="w", padx=PADX)
|
||||
label.grid(row=0, column=2, sticky=tk.W, padx=PADX)
|
||||
entry = validation.PositiveIntEntry(frame, textvariable=self.pixel_height)
|
||||
entry.grid(row=0, column=3, sticky="ew", padx=PADX)
|
||||
entry.grid(row=0, column=3, sticky=tk.EW, padx=PADX)
|
||||
entry.bind("<KeyRelease>", self.size_scale_keyup)
|
||||
label = ttk.Label(frame, text="Pixels")
|
||||
label.grid(row=0, column=4, sticky="w")
|
||||
label.grid(row=0, column=4, sticky=tk.W)
|
||||
|
||||
# draw size row 2
|
||||
frame = ttk.Frame(label_frame)
|
||||
frame.grid(sticky="ew", pady=PADY)
|
||||
frame.grid(sticky=tk.EW, pady=PADY)
|
||||
frame.columnconfigure(1, weight=1)
|
||||
frame.columnconfigure(3, weight=1)
|
||||
label = ttk.Label(frame, text="Width")
|
||||
label.grid(row=0, column=0, sticky="w", padx=PADX)
|
||||
label.grid(row=0, column=0, sticky=tk.W, padx=PADX)
|
||||
entry = validation.PositiveFloatEntry(
|
||||
frame, textvariable=self.meters_width, state=tk.DISABLED
|
||||
)
|
||||
entry.grid(row=0, column=1, sticky="ew", padx=PADX)
|
||||
entry.grid(row=0, column=1, sticky=tk.EW, padx=PADX)
|
||||
label = ttk.Label(frame, text="x Height")
|
||||
label.grid(row=0, column=2, sticky="w", padx=PADX)
|
||||
label.grid(row=0, column=2, sticky=tk.W, padx=PADX)
|
||||
entry = validation.PositiveFloatEntry(
|
||||
frame, textvariable=self.meters_height, state=tk.DISABLED
|
||||
)
|
||||
entry.grid(row=0, column=3, sticky="ew", padx=PADX)
|
||||
entry.grid(row=0, column=3, sticky=tk.EW, padx=PADX)
|
||||
label = ttk.Label(frame, text="Meters")
|
||||
label.grid(row=0, column=4, sticky="w")
|
||||
label.grid(row=0, column=4, sticky=tk.W)
|
||||
|
||||
def draw_scale(self) -> None:
|
||||
label_frame = ttk.Labelframe(self.top, text="Scale", padding=FRAME_PAD)
|
||||
label_frame.grid(sticky="ew")
|
||||
label_frame.grid(sticky=tk.EW)
|
||||
label_frame.columnconfigure(0, weight=1)
|
||||
|
||||
frame = ttk.Frame(label_frame)
|
||||
frame.grid(sticky="ew")
|
||||
frame.grid(sticky=tk.EW)
|
||||
frame.columnconfigure(1, weight=1)
|
||||
label = ttk.Label(frame, text=f"{PIXEL_SCALE} Pixels =")
|
||||
label.grid(row=0, column=0, sticky="w", padx=PADX)
|
||||
label.grid(row=0, column=0, sticky=tk.W, padx=PADX)
|
||||
entry = validation.PositiveFloatEntry(frame, textvariable=self.scale)
|
||||
entry.grid(row=0, column=1, sticky="ew", padx=PADX)
|
||||
entry.grid(row=0, column=1, sticky=tk.EW, padx=PADX)
|
||||
entry.bind("<KeyRelease>", self.size_scale_keyup)
|
||||
label = ttk.Label(frame, text="Meters")
|
||||
label.grid(row=0, column=2, sticky="w")
|
||||
label.grid(row=0, column=2, sticky=tk.W)
|
||||
|
||||
def draw_reference_point(self) -> None:
|
||||
label_frame = ttk.Labelframe(
|
||||
self.top, text="Reference Point", padding=FRAME_PAD
|
||||
)
|
||||
label_frame.grid(sticky="ew")
|
||||
label_frame.grid(sticky=tk.EW)
|
||||
label_frame.columnconfigure(0, weight=1)
|
||||
|
||||
label = ttk.Label(
|
||||
|
@ -124,61 +124,61 @@ class SizeAndScaleDialog(Dialog):
|
|||
label.grid()
|
||||
|
||||
frame = ttk.Frame(label_frame)
|
||||
frame.grid(sticky="ew", pady=PADY)
|
||||
frame.grid(sticky=tk.EW, pady=PADY)
|
||||
frame.columnconfigure(1, weight=1)
|
||||
frame.columnconfigure(3, weight=1)
|
||||
|
||||
label = ttk.Label(frame, text="X")
|
||||
label.grid(row=0, column=0, sticky="w", padx=PADX)
|
||||
label.grid(row=0, column=0, sticky=tk.W, padx=PADX)
|
||||
entry = validation.PositiveFloatEntry(frame, textvariable=self.x)
|
||||
entry.grid(row=0, column=1, sticky="ew", padx=PADX)
|
||||
entry.grid(row=0, column=1, sticky=tk.EW, padx=PADX)
|
||||
|
||||
label = ttk.Label(frame, text="Y")
|
||||
label.grid(row=0, column=2, sticky="w", padx=PADX)
|
||||
label.grid(row=0, column=2, sticky=tk.W, padx=PADX)
|
||||
entry = validation.PositiveFloatEntry(frame, textvariable=self.y)
|
||||
entry.grid(row=0, column=3, sticky="ew", padx=PADX)
|
||||
entry.grid(row=0, column=3, sticky=tk.EW, padx=PADX)
|
||||
|
||||
label = ttk.Label(label_frame, text="Translates To")
|
||||
label.grid()
|
||||
|
||||
frame = ttk.Frame(label_frame)
|
||||
frame.grid(sticky="ew", pady=PADY)
|
||||
frame.grid(sticky=tk.EW, pady=PADY)
|
||||
frame.columnconfigure(1, weight=1)
|
||||
frame.columnconfigure(3, weight=1)
|
||||
frame.columnconfigure(5, weight=1)
|
||||
|
||||
label = ttk.Label(frame, text="Lat")
|
||||
label.grid(row=0, column=0, sticky="w", padx=PADX)
|
||||
label.grid(row=0, column=0, sticky=tk.W, padx=PADX)
|
||||
entry = validation.FloatEntry(frame, textvariable=self.lat)
|
||||
entry.grid(row=0, column=1, sticky="ew", padx=PADX)
|
||||
entry.grid(row=0, column=1, sticky=tk.EW, padx=PADX)
|
||||
|
||||
label = ttk.Label(frame, text="Lon")
|
||||
label.grid(row=0, column=2, sticky="w", padx=PADX)
|
||||
label.grid(row=0, column=2, sticky=tk.W, padx=PADX)
|
||||
entry = validation.FloatEntry(frame, textvariable=self.lon)
|
||||
entry.grid(row=0, column=3, sticky="ew", padx=PADX)
|
||||
entry.grid(row=0, column=3, sticky=tk.EW, padx=PADX)
|
||||
|
||||
label = ttk.Label(frame, text="Alt")
|
||||
label.grid(row=0, column=4, sticky="w", padx=PADX)
|
||||
label.grid(row=0, column=4, sticky=tk.W, padx=PADX)
|
||||
entry = validation.FloatEntry(frame, textvariable=self.alt)
|
||||
entry.grid(row=0, column=5, sticky="ew")
|
||||
entry.grid(row=0, column=5, sticky=tk.EW)
|
||||
|
||||
def draw_save_as_default(self) -> None:
|
||||
button = ttk.Checkbutton(
|
||||
self.top, text="Save as default?", variable=self.save_default
|
||||
)
|
||||
button.grid(sticky="w", pady=PADY)
|
||||
button.grid(sticky=tk.W, pady=PADY)
|
||||
|
||||
def draw_buttons(self) -> None:
|
||||
frame = ttk.Frame(self.top)
|
||||
frame.columnconfigure(0, weight=1)
|
||||
frame.columnconfigure(1, weight=1)
|
||||
frame.grid(sticky="ew")
|
||||
frame.grid(sticky=tk.EW)
|
||||
|
||||
button = ttk.Button(frame, text="Apply", command=self.click_apply)
|
||||
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 size_scale_keyup(self, _event: tk.Event) -> None:
|
||||
scale = self.scale.get()
|
||||
|
|
|
@ -51,7 +51,7 @@ class CanvasWallpaperDialog(Dialog):
|
|||
|
||||
def draw_image_label(self) -> None:
|
||||
label = ttk.Label(self.top, text="Image filename: ")
|
||||
label.grid(sticky="ew")
|
||||
label.grid(sticky=tk.EW)
|
||||
if self.filename.get():
|
||||
self.draw_preview()
|
||||
|
||||
|
@ -60,17 +60,17 @@ class CanvasWallpaperDialog(Dialog):
|
|||
frame.columnconfigure(0, weight=2)
|
||||
frame.columnconfigure(1, weight=1)
|
||||
frame.columnconfigure(2, weight=1)
|
||||
frame.grid(sticky="ew")
|
||||
frame.grid(sticky=tk.EW, pady=PADY)
|
||||
|
||||
entry = ttk.Entry(frame, textvariable=self.filename)
|
||||
entry.focus()
|
||||
entry.grid(row=0, column=0, sticky="ew", padx=PADX)
|
||||
entry.grid(row=0, column=0, sticky=tk.EW, padx=PADX)
|
||||
|
||||
button = ttk.Button(frame, text="...", command=self.click_open_image)
|
||||
button.grid(row=0, column=1, sticky="ew", padx=PADX)
|
||||
button.grid(row=0, column=1, sticky=tk.EW, padx=PADX)
|
||||
|
||||
button = ttk.Button(frame, text="Clear", command=self.click_clear)
|
||||
button.grid(row=0, column=2, sticky="ew")
|
||||
button.grid(row=0, column=2, sticky=tk.EW)
|
||||
|
||||
def draw_options(self) -> None:
|
||||
frame = ttk.Frame(self.top)
|
||||
|
@ -78,30 +78,30 @@ class CanvasWallpaperDialog(Dialog):
|
|||
frame.columnconfigure(1, weight=1)
|
||||
frame.columnconfigure(2, weight=1)
|
||||
frame.columnconfigure(3, weight=1)
|
||||
frame.grid(sticky="ew")
|
||||
frame.grid(sticky=tk.EW, pady=PADY)
|
||||
|
||||
button = ttk.Radiobutton(
|
||||
frame, text="upper-left", value=1, variable=self.scale_option
|
||||
)
|
||||
button.grid(row=0, column=0, sticky="ew")
|
||||
button.grid(row=0, column=0, sticky=tk.EW)
|
||||
self.options.append(button)
|
||||
|
||||
button = ttk.Radiobutton(
|
||||
frame, text="centered", value=2, variable=self.scale_option
|
||||
)
|
||||
button.grid(row=0, column=1, sticky="ew")
|
||||
button.grid(row=0, column=1, sticky=tk.EW)
|
||||
self.options.append(button)
|
||||
|
||||
button = ttk.Radiobutton(
|
||||
frame, text="scaled", value=3, variable=self.scale_option
|
||||
)
|
||||
button.grid(row=0, column=2, sticky="ew")
|
||||
button.grid(row=0, column=2, sticky=tk.EW)
|
||||
self.options.append(button)
|
||||
|
||||
button = ttk.Radiobutton(
|
||||
frame, text="titled", value=4, variable=self.scale_option
|
||||
)
|
||||
button.grid(row=0, column=3, sticky="ew")
|
||||
button.grid(row=0, column=3, sticky=tk.EW)
|
||||
self.options.append(button)
|
||||
|
||||
def draw_additional_options(self) -> None:
|
||||
|
@ -111,19 +111,19 @@ class CanvasWallpaperDialog(Dialog):
|
|||
variable=self.adjust_to_dim,
|
||||
command=self.click_adjust_canvas,
|
||||
)
|
||||
checkbutton.grid(sticky="ew", padx=PADX)
|
||||
checkbutton.grid(sticky=tk.EW, padx=PADX, pady=PADY)
|
||||
|
||||
def draw_buttons(self) -> None:
|
||||
frame = ttk.Frame(self.top)
|
||||
frame.grid(pady=PADY, sticky="ew")
|
||||
frame.grid(sticky=tk.EW)
|
||||
frame.columnconfigure(0, weight=1)
|
||||
frame.columnconfigure(1, weight=1)
|
||||
|
||||
button = ttk.Button(frame, text="Apply", command=self.click_apply)
|
||||
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_open_image(self) -> None:
|
||||
filename = image_chooser(self, BACKGROUNDS_PATH)
|
||||
|
|
|
@ -48,13 +48,13 @@ class ColorPickerDialog(Dialog):
|
|||
|
||||
# rgb frames
|
||||
frame = ttk.Frame(self.top)
|
||||
frame.grid(row=0, column=0, sticky="ew", pady=PADY)
|
||||
frame.grid(row=0, column=0, sticky=tk.EW, pady=PADY)
|
||||
frame.columnconfigure(2, weight=3)
|
||||
frame.columnconfigure(3, weight=1)
|
||||
label = ttk.Label(frame, text="R")
|
||||
label.grid(row=0, column=0, padx=PADX)
|
||||
self.red_entry = validation.RgbEntry(frame, width=3, textvariable=self.red)
|
||||
self.red_entry.grid(row=0, column=1, sticky="ew", padx=PADX)
|
||||
self.red_entry.grid(row=0, column=1, sticky=tk.EW, padx=PADX)
|
||||
scale = ttk.Scale(
|
||||
frame,
|
||||
from_=0,
|
||||
|
@ -64,20 +64,20 @@ class ColorPickerDialog(Dialog):
|
|||
variable=self.red_scale,
|
||||
command=lambda x: self.scale_callback(self.red_scale, self.red),
|
||||
)
|
||||
scale.grid(row=0, column=2, sticky="ew", padx=PADX)
|
||||
scale.grid(row=0, column=2, sticky=tk.EW, padx=PADX)
|
||||
self.red_label = ttk.Label(
|
||||
frame, background="#%02x%02x%02x" % (self.red.get(), 0, 0), width=5
|
||||
)
|
||||
self.red_label.grid(row=0, column=3, sticky="ew")
|
||||
self.red_label.grid(row=0, column=3, sticky=tk.EW)
|
||||
|
||||
frame = ttk.Frame(self.top)
|
||||
frame.grid(row=1, column=0, sticky="ew", pady=PADY)
|
||||
frame.grid(row=1, column=0, sticky=tk.EW, pady=PADY)
|
||||
frame.columnconfigure(2, weight=3)
|
||||
frame.columnconfigure(3, weight=1)
|
||||
label = ttk.Label(frame, text="G")
|
||||
label.grid(row=0, column=0, padx=PADX)
|
||||
self.green_entry = validation.RgbEntry(frame, width=3, textvariable=self.green)
|
||||
self.green_entry.grid(row=0, column=1, sticky="ew", padx=PADX)
|
||||
self.green_entry.grid(row=0, column=1, sticky=tk.EW, padx=PADX)
|
||||
scale = ttk.Scale(
|
||||
frame,
|
||||
from_=0,
|
||||
|
@ -87,20 +87,20 @@ class ColorPickerDialog(Dialog):
|
|||
variable=self.green_scale,
|
||||
command=lambda x: self.scale_callback(self.green_scale, self.green),
|
||||
)
|
||||
scale.grid(row=0, column=2, sticky="ew", padx=PADX)
|
||||
scale.grid(row=0, column=2, sticky=tk.EW, padx=PADX)
|
||||
self.green_label = ttk.Label(
|
||||
frame, background="#%02x%02x%02x" % (0, self.green.get(), 0), width=5
|
||||
)
|
||||
self.green_label.grid(row=0, column=3, sticky="ew")
|
||||
self.green_label.grid(row=0, column=3, sticky=tk.EW)
|
||||
|
||||
frame = ttk.Frame(self.top)
|
||||
frame.grid(row=2, column=0, sticky="ew", pady=PADY)
|
||||
frame.grid(row=2, column=0, sticky=tk.EW, pady=PADY)
|
||||
frame.columnconfigure(2, weight=3)
|
||||
frame.columnconfigure(3, weight=1)
|
||||
label = ttk.Label(frame, text="B")
|
||||
label.grid(row=0, column=0, padx=PADX)
|
||||
self.blue_entry = validation.RgbEntry(frame, width=3, textvariable=self.blue)
|
||||
self.blue_entry.grid(row=0, column=1, sticky="ew", padx=PADX)
|
||||
self.blue_entry.grid(row=0, column=1, sticky=tk.EW, padx=PADX)
|
||||
scale = ttk.Scale(
|
||||
frame,
|
||||
from_=0,
|
||||
|
@ -110,31 +110,31 @@ class ColorPickerDialog(Dialog):
|
|||
variable=self.blue_scale,
|
||||
command=lambda x: self.scale_callback(self.blue_scale, self.blue),
|
||||
)
|
||||
scale.grid(row=0, column=2, sticky="ew", padx=PADX)
|
||||
scale.grid(row=0, column=2, sticky=tk.EW, padx=PADX)
|
||||
self.blue_label = ttk.Label(
|
||||
frame, background="#%02x%02x%02x" % (0, 0, self.blue.get()), width=5
|
||||
)
|
||||
self.blue_label.grid(row=0, column=3, sticky="ew")
|
||||
self.blue_label.grid(row=0, column=3, sticky=tk.EW)
|
||||
|
||||
# hex code and color display
|
||||
frame = ttk.Frame(self.top)
|
||||
frame.columnconfigure(0, weight=1)
|
||||
frame.rowconfigure(1, weight=1)
|
||||
self.hex_entry = validation.HexEntry(frame, textvariable=self.hex)
|
||||
self.hex_entry.grid(sticky="ew", pady=PADY)
|
||||
self.hex_entry.grid(sticky=tk.EW, pady=PADY)
|
||||
self.display = tk.Frame(frame, background=self.color, width=100, height=100)
|
||||
self.display.grid(sticky="nsew")
|
||||
frame.grid(row=3, column=0, sticky="nsew", pady=PADY)
|
||||
self.display.grid(sticky=tk.NSEW)
|
||||
frame.grid(row=3, column=0, sticky=tk.NSEW, pady=PADY)
|
||||
|
||||
# button frame
|
||||
frame = ttk.Frame(self.top)
|
||||
frame.grid(row=4, column=0, sticky="ew")
|
||||
frame.grid(row=4, column=0, sticky=tk.EW)
|
||||
frame.columnconfigure(0, weight=1)
|
||||
frame.columnconfigure(1, weight=1)
|
||||
button = ttk.Button(frame, text="OK", command=self.button_ok)
|
||||
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 set_bindings(self) -> None:
|
||||
self.red_entry.bind("<FocusIn>", lambda x: self.current_focus("rgb"))
|
||||
|
|
|
@ -111,7 +111,7 @@ class ConfigServiceConfigDialog(Dialog):
|
|||
|
||||
# draw notebook
|
||||
self.notebook = ttk.Notebook(self.top)
|
||||
self.notebook.grid(sticky="nsew", pady=PADY)
|
||||
self.notebook.grid(sticky=tk.NSEW, pady=PADY)
|
||||
self.draw_tab_files()
|
||||
if self.config:
|
||||
self.draw_tab_config()
|
||||
|
@ -121,7 +121,7 @@ class ConfigServiceConfigDialog(Dialog):
|
|||
|
||||
def draw_tab_files(self) -> None:
|
||||
tab = ttk.Frame(self.notebook, padding=FRAME_PAD)
|
||||
tab.grid(sticky="nsew")
|
||||
tab.grid(sticky=tk.NSEW)
|
||||
tab.columnconfigure(0, weight=1)
|
||||
self.notebook.add(tab, text="Directories/Files")
|
||||
|
||||
|
@ -131,29 +131,29 @@ class ConfigServiceConfigDialog(Dialog):
|
|||
label.grid(pady=PADY)
|
||||
|
||||
frame = ttk.Frame(tab)
|
||||
frame.grid(sticky="ew", pady=PADY)
|
||||
frame.grid(sticky=tk.EW, pady=PADY)
|
||||
frame.columnconfigure(1, weight=1)
|
||||
label = ttk.Label(frame, text="Directories")
|
||||
label.grid(row=0, column=0, sticky="w", padx=PADX)
|
||||
label.grid(row=0, column=0, sticky=tk.W, padx=PADX)
|
||||
directories_combobox = ttk.Combobox(
|
||||
frame, values=self.directories, state="readonly"
|
||||
)
|
||||
directories_combobox.grid(row=0, column=1, sticky="ew", pady=PADY)
|
||||
directories_combobox.grid(row=0, column=1, sticky=tk.EW, pady=PADY)
|
||||
if self.directories:
|
||||
directories_combobox.current(0)
|
||||
|
||||
label = ttk.Label(frame, text="Templates")
|
||||
label.grid(row=1, column=0, sticky="w", padx=PADX)
|
||||
label.grid(row=1, column=0, sticky=tk.W, padx=PADX)
|
||||
self.templates_combobox = ttk.Combobox(
|
||||
frame, values=self.templates, state="readonly"
|
||||
)
|
||||
self.templates_combobox.bind(
|
||||
"<<ComboboxSelected>>", self.handle_template_changed
|
||||
)
|
||||
self.templates_combobox.grid(row=1, column=1, sticky="ew", pady=PADY)
|
||||
self.templates_combobox.grid(row=1, column=1, sticky=tk.EW, pady=PADY)
|
||||
|
||||
self.template_text = CodeText(tab)
|
||||
self.template_text.grid(sticky="nsew")
|
||||
self.template_text.grid(sticky=tk.NSEW)
|
||||
tab.rowconfigure(self.template_text.grid_info()["row"], weight=1)
|
||||
if self.templates:
|
||||
self.templates_combobox.current(0)
|
||||
|
@ -165,13 +165,13 @@ class ConfigServiceConfigDialog(Dialog):
|
|||
|
||||
def draw_tab_config(self) -> None:
|
||||
tab = ttk.Frame(self.notebook, padding=FRAME_PAD)
|
||||
tab.grid(sticky="nsew")
|
||||
tab.grid(sticky=tk.NSEW)
|
||||
tab.columnconfigure(0, weight=1)
|
||||
self.notebook.add(tab, text="Configuration")
|
||||
|
||||
if self.modes:
|
||||
frame = ttk.Frame(tab)
|
||||
frame.grid(sticky="ew", pady=PADY)
|
||||
frame.grid(sticky=tk.EW, pady=PADY)
|
||||
frame.columnconfigure(1, weight=1)
|
||||
label = ttk.Label(frame, text="Modes")
|
||||
label.grid(row=0, column=0, padx=PADX)
|
||||
|
@ -179,17 +179,17 @@ class ConfigServiceConfigDialog(Dialog):
|
|||
frame, values=self.modes, state="readonly"
|
||||
)
|
||||
self.modes_combobox.bind("<<ComboboxSelected>>", self.handle_mode_changed)
|
||||
self.modes_combobox.grid(row=0, column=1, sticky="ew", pady=PADY)
|
||||
self.modes_combobox.grid(row=0, column=1, sticky=tk.EW, pady=PADY)
|
||||
|
||||
logging.info("config service config: %s", self.config)
|
||||
self.config_frame = ConfigFrame(tab, self.app, self.config)
|
||||
self.config_frame.draw_config()
|
||||
self.config_frame.grid(sticky="nsew", pady=PADY)
|
||||
self.config_frame.grid(sticky=tk.NSEW, pady=PADY)
|
||||
tab.rowconfigure(self.config_frame.grid_info()["row"], weight=1)
|
||||
|
||||
def draw_tab_startstop(self) -> None:
|
||||
tab = ttk.Frame(self.notebook, padding=FRAME_PAD)
|
||||
tab.grid(sticky="nsew")
|
||||
tab.grid(sticky=tk.NSEW)
|
||||
tab.columnconfigure(0, weight=1)
|
||||
for i in range(3):
|
||||
tab.rowconfigure(i, weight=1)
|
||||
|
@ -215,12 +215,12 @@ class ConfigServiceConfigDialog(Dialog):
|
|||
commands = self.validation_commands
|
||||
label_frame.columnconfigure(0, weight=1)
|
||||
label_frame.rowconfigure(0, weight=1)
|
||||
label_frame.grid(row=i, column=0, sticky="nsew", pady=PADY)
|
||||
label_frame.grid(row=i, column=0, sticky=tk.NSEW, pady=PADY)
|
||||
listbox_scroll = ListboxScroll(label_frame)
|
||||
for command in commands:
|
||||
listbox_scroll.listbox.insert("end", command)
|
||||
listbox_scroll.listbox.config(height=4)
|
||||
listbox_scroll.grid(sticky="nsew")
|
||||
listbox_scroll.grid(sticky=tk.NSEW)
|
||||
if i == 0:
|
||||
self.startup_commands_listbox = listbox_scroll.listbox
|
||||
elif i == 1:
|
||||
|
@ -230,23 +230,23 @@ class ConfigServiceConfigDialog(Dialog):
|
|||
|
||||
def draw_tab_validation(self) -> None:
|
||||
tab = ttk.Frame(self.notebook, padding=FRAME_PAD)
|
||||
tab.grid(sticky="ew")
|
||||
tab.grid(sticky=tk.EW)
|
||||
tab.columnconfigure(0, weight=1)
|
||||
self.notebook.add(tab, text="Validation", sticky="nsew")
|
||||
self.notebook.add(tab, text="Validation", sticky=tk.NSEW)
|
||||
|
||||
frame = ttk.Frame(tab)
|
||||
frame.grid(sticky="ew", pady=PADY)
|
||||
frame.grid(sticky=tk.EW, pady=PADY)
|
||||
frame.columnconfigure(1, weight=1)
|
||||
|
||||
label = ttk.Label(frame, text="Validation Time")
|
||||
label.grid(row=0, column=0, sticky="w", padx=PADX)
|
||||
label.grid(row=0, column=0, sticky=tk.W, padx=PADX)
|
||||
self.validation_time_entry = ttk.Entry(frame)
|
||||
self.validation_time_entry.insert("end", self.validation_time)
|
||||
self.validation_time_entry.config(state=tk.DISABLED)
|
||||
self.validation_time_entry.grid(row=0, column=1, sticky="ew", pady=PADY)
|
||||
self.validation_time_entry.grid(row=0, column=1, sticky=tk.EW, pady=PADY)
|
||||
|
||||
label = ttk.Label(frame, text="Validation Mode")
|
||||
label.grid(row=1, column=0, sticky="w", padx=PADX)
|
||||
label.grid(row=1, column=0, sticky=tk.W, padx=PADX)
|
||||
if self.validation_mode == ServiceValidationMode.BLOCKING:
|
||||
mode = "BLOCKING"
|
||||
elif self.validation_mode == ServiceValidationMode.NON_BLOCKING:
|
||||
|
@ -258,48 +258,48 @@ class ConfigServiceConfigDialog(Dialog):
|
|||
)
|
||||
self.validation_mode_entry.insert("end", mode)
|
||||
self.validation_mode_entry.config(state=tk.DISABLED)
|
||||
self.validation_mode_entry.grid(row=1, column=1, sticky="ew", pady=PADY)
|
||||
self.validation_mode_entry.grid(row=1, column=1, sticky=tk.EW, pady=PADY)
|
||||
|
||||
label = ttk.Label(frame, text="Validation Period")
|
||||
label.grid(row=2, column=0, sticky="w", padx=PADX)
|
||||
label.grid(row=2, column=0, sticky=tk.W, padx=PADX)
|
||||
self.validation_period_entry = ttk.Entry(
|
||||
frame, state=tk.DISABLED, textvariable=self.validation_period
|
||||
)
|
||||
self.validation_period_entry.grid(row=2, column=1, sticky="ew", pady=PADY)
|
||||
self.validation_period_entry.grid(row=2, column=1, sticky=tk.EW, pady=PADY)
|
||||
|
||||
label_frame = ttk.LabelFrame(tab, text="Executables", padding=FRAME_PAD)
|
||||
label_frame.grid(sticky="nsew", pady=PADY)
|
||||
label_frame.grid(sticky=tk.NSEW, pady=PADY)
|
||||
label_frame.columnconfigure(0, weight=1)
|
||||
label_frame.rowconfigure(0, weight=1)
|
||||
listbox_scroll = ListboxScroll(label_frame)
|
||||
listbox_scroll.grid(sticky="nsew")
|
||||
listbox_scroll.grid(sticky=tk.NSEW)
|
||||
tab.rowconfigure(listbox_scroll.grid_info()["row"], weight=1)
|
||||
for executable in self.executables:
|
||||
listbox_scroll.listbox.insert("end", executable)
|
||||
|
||||
label_frame = ttk.LabelFrame(tab, text="Dependencies", padding=FRAME_PAD)
|
||||
label_frame.grid(sticky="nsew", pady=PADY)
|
||||
label_frame.grid(sticky=tk.NSEW, pady=PADY)
|
||||
label_frame.columnconfigure(0, weight=1)
|
||||
label_frame.rowconfigure(0, weight=1)
|
||||
listbox_scroll = ListboxScroll(label_frame)
|
||||
listbox_scroll.grid(sticky="nsew")
|
||||
listbox_scroll.grid(sticky=tk.NSEW)
|
||||
tab.rowconfigure(listbox_scroll.grid_info()["row"], weight=1)
|
||||
for dependency in self.dependencies:
|
||||
listbox_scroll.listbox.insert("end", dependency)
|
||||
|
||||
def draw_buttons(self) -> None:
|
||||
frame = ttk.Frame(self.top)
|
||||
frame.grid(sticky="ew")
|
||||
frame.grid(sticky=tk.EW)
|
||||
for i in range(4):
|
||||
frame.columnconfigure(i, weight=1)
|
||||
button = ttk.Button(frame, text="Apply", command=self.click_apply)
|
||||
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="Defaults", command=self.click_defaults)
|
||||
button.grid(row=0, column=1, sticky="ew", padx=PADX)
|
||||
button.grid(row=0, column=1, sticky=tk.EW, padx=PADX)
|
||||
button = ttk.Button(frame, text="Copy...", command=self.click_copy)
|
||||
button.grid(row=0, column=2, sticky="ew", padx=PADX)
|
||||
button.grid(row=0, column=2, sticky=tk.EW, padx=PADX)
|
||||
button = ttk.Button(frame, text="Cancel", command=self.destroy)
|
||||
button.grid(row=0, column=3, sticky="ew")
|
||||
button.grid(row=0, column=3, sticky=tk.EW)
|
||||
|
||||
def click_apply(self) -> None:
|
||||
current_listbox = self.master.current.listbox
|
||||
|
|
|
@ -38,10 +38,10 @@ class CopyServiceConfigDialog(Dialog):
|
|||
label = ttk.Label(
|
||||
self.top, text=f"{self.service} - {self.file_name}", anchor=tk.CENTER
|
||||
)
|
||||
label.grid(sticky="ew", pady=PADY)
|
||||
label.grid(sticky=tk.EW, pady=PADY)
|
||||
|
||||
listbox_scroll = ListboxScroll(self.top)
|
||||
listbox_scroll.grid(sticky="nsew", pady=PADY)
|
||||
listbox_scroll.grid(sticky=tk.NSEW, pady=PADY)
|
||||
self.listbox = listbox_scroll.listbox
|
||||
for node in self.app.core.session.nodes.values():
|
||||
file_configs = node.service_file_configs.get(self.service)
|
||||
|
@ -54,15 +54,15 @@ class CopyServiceConfigDialog(Dialog):
|
|||
self.listbox.insert(tk.END, node.name)
|
||||
|
||||
frame = ttk.Frame(self.top)
|
||||
frame.grid(sticky="ew")
|
||||
frame.grid(sticky=tk.EW)
|
||||
for i in range(3):
|
||||
frame.columnconfigure(i, weight=1)
|
||||
button = ttk.Button(frame, text="Copy", command=self.click_copy)
|
||||
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="View", command=self.click_view)
|
||||
button.grid(row=0, column=1, sticky="ew", padx=PADX)
|
||||
button.grid(row=0, column=1, sticky=tk.EW, padx=PADX)
|
||||
button = ttk.Button(frame, text="Cancel", command=self.destroy)
|
||||
button.grid(row=0, column=2, sticky="ew")
|
||||
button.grid(row=0, column=2, sticky=tk.EW)
|
||||
|
||||
def click_copy(self) -> None:
|
||||
selection = self.listbox.curselection()
|
||||
|
@ -112,8 +112,8 @@ class ViewConfigDialog(Dialog):
|
|||
self.top.columnconfigure(0, weight=1)
|
||||
self.top.rowconfigure(0, weight=1)
|
||||
self.service_data = CodeText(self.top)
|
||||
self.service_data.grid(sticky="nsew", pady=PADY)
|
||||
self.service_data.grid(sticky=tk.NSEW, pady=PADY)
|
||||
self.service_data.text.insert(tk.END, self.data)
|
||||
self.service_data.text.config(state=tk.DISABLED)
|
||||
button = ttk.Button(self.top, text="Close", command=self.destroy)
|
||||
button.grid(sticky="ew")
|
||||
button.grid(sticky=tk.EW)
|
||||
|
|
|
@ -34,47 +34,47 @@ class ServicesSelectDialog(Dialog):
|
|||
self.top.rowconfigure(0, weight=1)
|
||||
|
||||
frame = ttk.LabelFrame(self.top)
|
||||
frame.grid(stick="nsew", pady=PADY)
|
||||
frame.grid(stick=tk.NSEW, pady=PADY)
|
||||
frame.rowconfigure(0, weight=1)
|
||||
for i in range(3):
|
||||
frame.columnconfigure(i, weight=1)
|
||||
label_frame = ttk.LabelFrame(frame, text="Groups", padding=FRAME_PAD)
|
||||
label_frame.grid(row=0, column=0, sticky="nsew")
|
||||
label_frame.grid(row=0, column=0, sticky=tk.NSEW)
|
||||
label_frame.rowconfigure(0, weight=1)
|
||||
label_frame.columnconfigure(0, weight=1)
|
||||
self.groups = ListboxScroll(label_frame)
|
||||
self.groups.grid(sticky="nsew")
|
||||
self.groups.grid(sticky=tk.NSEW)
|
||||
for group in sorted(self.app.core.services):
|
||||
self.groups.listbox.insert(tk.END, group)
|
||||
self.groups.listbox.bind("<<ListboxSelect>>", self.handle_group_change)
|
||||
self.groups.listbox.selection_set(0)
|
||||
|
||||
label_frame = ttk.LabelFrame(frame, text="Services")
|
||||
label_frame.grid(row=0, column=1, sticky="nsew")
|
||||
label_frame.grid(row=0, column=1, sticky=tk.NSEW)
|
||||
label_frame.columnconfigure(0, weight=1)
|
||||
label_frame.rowconfigure(0, weight=1)
|
||||
self.services = CheckboxList(
|
||||
label_frame, self.app, clicked=self.service_clicked, padding=FRAME_PAD
|
||||
)
|
||||
self.services.grid(sticky="nsew")
|
||||
self.services.grid(sticky=tk.NSEW)
|
||||
|
||||
label_frame = ttk.LabelFrame(frame, text="Selected", padding=FRAME_PAD)
|
||||
label_frame.grid(row=0, column=2, sticky="nsew")
|
||||
label_frame.grid(row=0, column=2, sticky=tk.NSEW)
|
||||
label_frame.rowconfigure(0, weight=1)
|
||||
label_frame.columnconfigure(0, weight=1)
|
||||
self.current = ListboxScroll(label_frame)
|
||||
self.current.grid(sticky="nsew")
|
||||
self.current.grid(sticky=tk.NSEW)
|
||||
for service in sorted(self.current_services):
|
||||
self.current.listbox.insert(tk.END, service)
|
||||
|
||||
frame = ttk.Frame(self.top)
|
||||
frame.grid(stick="ew")
|
||||
frame.grid(stick=tk.EW)
|
||||
for i in range(2):
|
||||
frame.columnconfigure(i, weight=1)
|
||||
button = ttk.Button(frame, text="Save", command=self.destroy)
|
||||
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.click_cancel)
|
||||
button.grid(row=0, column=1, sticky="ew")
|
||||
button.grid(row=0, column=1, sticky=tk.EW)
|
||||
|
||||
# trigger group change
|
||||
self.groups.listbox.event_generate("<<ListboxSelect>>")
|
||||
|
@ -127,58 +127,58 @@ class CustomNodesDialog(Dialog):
|
|||
|
||||
def draw_node_config(self) -> None:
|
||||
frame = ttk.LabelFrame(self.top, text="Nodes", padding=FRAME_PAD)
|
||||
frame.grid(sticky="nsew", pady=PADY)
|
||||
frame.grid(sticky=tk.NSEW, pady=PADY)
|
||||
frame.columnconfigure(0, weight=1)
|
||||
frame.rowconfigure(0, weight=1)
|
||||
|
||||
self.nodes_list = ListboxScroll(frame)
|
||||
self.nodes_list.grid(row=0, column=0, sticky="nsew", padx=PADX)
|
||||
self.nodes_list.grid(row=0, column=0, sticky=tk.NSEW, padx=PADX)
|
||||
self.nodes_list.listbox.bind("<<ListboxSelect>>", self.handle_node_select)
|
||||
for name in sorted(self.app.core.custom_nodes):
|
||||
self.nodes_list.listbox.insert(tk.END, name)
|
||||
|
||||
frame = ttk.Frame(frame)
|
||||
frame.grid(row=0, column=2, sticky="nsew")
|
||||
frame.grid(row=0, column=2, sticky=tk.NSEW)
|
||||
frame.columnconfigure(0, weight=1)
|
||||
entry = ttk.Entry(frame, textvariable=self.name)
|
||||
entry.grid(sticky="ew", pady=PADY)
|
||||
entry.grid(sticky=tk.EW, pady=PADY)
|
||||
self.image_button = ttk.Button(
|
||||
frame, text="Icon", compound=tk.LEFT, command=self.click_icon
|
||||
)
|
||||
self.image_button.grid(sticky="ew", pady=PADY)
|
||||
self.image_button.grid(sticky=tk.EW, pady=PADY)
|
||||
button = ttk.Button(frame, text="Services", command=self.click_services)
|
||||
button.grid(sticky="ew")
|
||||
button.grid(sticky=tk.EW)
|
||||
|
||||
def draw_node_buttons(self) -> None:
|
||||
frame = ttk.Frame(self.top)
|
||||
frame.grid(sticky="ew", pady=PADY)
|
||||
frame.grid(sticky=tk.EW, pady=PADY)
|
||||
for i in range(3):
|
||||
frame.columnconfigure(i, weight=1)
|
||||
|
||||
button = ttk.Button(frame, text="Create", command=self.click_create)
|
||||
button.grid(row=0, column=0, sticky="ew", padx=PADX)
|
||||
button.grid(row=0, column=0, sticky=tk.EW, padx=PADX)
|
||||
|
||||
self.edit_button = ttk.Button(
|
||||
frame, text="Edit", state=tk.DISABLED, command=self.click_edit
|
||||
)
|
||||
self.edit_button.grid(row=0, column=1, sticky="ew", padx=PADX)
|
||||
self.edit_button.grid(row=0, column=1, sticky=tk.EW, padx=PADX)
|
||||
|
||||
self.delete_button = ttk.Button(
|
||||
frame, text="Delete", state=tk.DISABLED, command=self.click_delete
|
||||
)
|
||||
self.delete_button.grid(row=0, column=2, sticky="ew")
|
||||
self.delete_button.grid(row=0, column=2, sticky=tk.EW)
|
||||
|
||||
def draw_buttons(self) -> None:
|
||||
frame = ttk.Frame(self.top)
|
||||
frame.grid(sticky="ew")
|
||||
frame.grid(sticky=tk.EW)
|
||||
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 reset_values(self) -> None:
|
||||
self.name.set("")
|
||||
|
|
|
@ -30,7 +30,7 @@ class Dialog(tk.Toplevel):
|
|||
self.columnconfigure(0, weight=1)
|
||||
self.rowconfigure(0, weight=1)
|
||||
self.top: ttk.Frame = ttk.Frame(self, padding=DIALOG_PAD)
|
||||
self.top.grid(sticky="nsew")
|
||||
self.top.grid(sticky=tk.NSEW)
|
||||
|
||||
def show(self) -> None:
|
||||
self.transient(self.master)
|
||||
|
@ -44,6 +44,6 @@ class Dialog(tk.Toplevel):
|
|||
|
||||
def draw_spacer(self, row: int = None) -> None:
|
||||
frame = ttk.Frame(self.top)
|
||||
frame.grid(row=row, sticky="nsew")
|
||||
frame.grid(row=row, sticky=tk.NSEW)
|
||||
frame.rowconfigure(0, weight=1)
|
||||
self.top.rowconfigure(frame.grid_info()["row"], weight=1)
|
||||
|
|
|
@ -33,20 +33,20 @@ class GlobalEmaneDialog(Dialog):
|
|||
self.top, self.app, session.emane_config, self.enabled
|
||||
)
|
||||
self.config_frame.draw_config()
|
||||
self.config_frame.grid(sticky="nsew", pady=PADY)
|
||||
self.config_frame.grid(sticky=tk.NSEW, pady=PADY)
|
||||
self.draw_spacer()
|
||||
self.draw_buttons()
|
||||
|
||||
def draw_buttons(self) -> None:
|
||||
frame = ttk.Frame(self.top)
|
||||
frame.grid(sticky="ew")
|
||||
frame.grid(sticky=tk.EW)
|
||||
for i in range(2):
|
||||
frame.columnconfigure(i, weight=1)
|
||||
state = tk.NORMAL if self.enabled else tk.DISABLED
|
||||
button = ttk.Button(frame, text="Apply", command=self.click_apply, state=state)
|
||||
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_apply(self) -> None:
|
||||
self.config_frame.parse_config()
|
||||
|
@ -87,20 +87,20 @@ class EmaneModelDialog(Dialog):
|
|||
self.top.rowconfigure(0, weight=1)
|
||||
self.config_frame = ConfigFrame(self.top, self.app, self.config, self.enabled)
|
||||
self.config_frame.draw_config()
|
||||
self.config_frame.grid(sticky="nsew", pady=PADY)
|
||||
self.config_frame.grid(sticky=tk.NSEW, pady=PADY)
|
||||
self.draw_spacer()
|
||||
self.draw_buttons()
|
||||
|
||||
def draw_buttons(self) -> None:
|
||||
frame = ttk.Frame(self.top)
|
||||
frame.grid(sticky="ew")
|
||||
frame.grid(sticky=tk.EW)
|
||||
for i in range(2):
|
||||
frame.columnconfigure(i, weight=1)
|
||||
state = tk.NORMAL if self.enabled else tk.DISABLED
|
||||
button = ttk.Button(frame, text="Apply", command=self.click_apply, state=state)
|
||||
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_apply(self) -> None:
|
||||
self.config_frame.parse_config()
|
||||
|
@ -156,30 +156,30 @@ class EmaneConfigDialog(Dialog):
|
|||
),
|
||||
)
|
||||
button.image = image
|
||||
button.grid(sticky="ew", pady=PADY)
|
||||
button.grid(sticky=tk.EW, pady=PADY)
|
||||
|
||||
def draw_emane_models(self) -> None:
|
||||
"""
|
||||
create a combobox that has all the known emane models
|
||||
"""
|
||||
frame = ttk.Frame(self.top)
|
||||
frame.grid(sticky="ew", pady=PADY)
|
||||
frame.grid(sticky=tk.EW, pady=PADY)
|
||||
frame.columnconfigure(1, weight=1)
|
||||
|
||||
label = ttk.Label(frame, text="Model")
|
||||
label.grid(row=0, column=0, sticky="w")
|
||||
label.grid(row=0, column=0, sticky=tk.W)
|
||||
|
||||
# create combo box and its binding
|
||||
state = "readonly" if self.enabled else tk.DISABLED
|
||||
combobox = ttk.Combobox(
|
||||
frame, textvariable=self.emane_model, values=self.emane_models, state=state
|
||||
)
|
||||
combobox.grid(row=0, column=1, sticky="ew")
|
||||
combobox.grid(row=0, column=1, sticky=tk.EW)
|
||||
combobox.bind("<<ComboboxSelected>>", self.emane_model_change)
|
||||
|
||||
def draw_emane_buttons(self) -> None:
|
||||
frame = ttk.Frame(self.top)
|
||||
frame.grid(sticky="ew", pady=PADY)
|
||||
frame.grid(sticky=tk.EW, pady=PADY)
|
||||
for i in range(2):
|
||||
frame.columnconfigure(i, weight=1)
|
||||
|
||||
|
@ -192,7 +192,7 @@ class EmaneConfigDialog(Dialog):
|
|||
command=self.click_model_config,
|
||||
)
|
||||
self.emane_model_button.image = image
|
||||
self.emane_model_button.grid(row=0, column=0, padx=PADX, sticky="ew")
|
||||
self.emane_model_button.grid(row=0, column=0, padx=PADX, sticky=tk.EW)
|
||||
|
||||
image = Images.get(ImageEnum.EDITNODE, 16)
|
||||
button = ttk.Button(
|
||||
|
@ -203,18 +203,18 @@ class EmaneConfigDialog(Dialog):
|
|||
command=self.click_emane_config,
|
||||
)
|
||||
button.image = image
|
||||
button.grid(row=0, column=1, sticky="ew")
|
||||
button.grid(row=0, column=1, sticky=tk.EW)
|
||||
|
||||
def draw_apply_and_cancel(self) -> None:
|
||||
frame = ttk.Frame(self.top)
|
||||
frame.grid(sticky="ew")
|
||||
frame.grid(sticky=tk.EW)
|
||||
for i in range(2):
|
||||
frame.columnconfigure(i, weight=1)
|
||||
state = tk.NORMAL if self.enabled else tk.DISABLED
|
||||
button = ttk.Button(frame, text="Apply", command=self.click_apply, state=state)
|
||||
button.grid(row=0, column=0, padx=PADX, sticky="ew")
|
||||
button.grid(row=0, column=0, padx=PADX, sticky=tk.EW)
|
||||
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_emane_config(self) -> None:
|
||||
dialog = GlobalEmaneDialog(self, self.app)
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import tkinter as tk
|
||||
import webbrowser
|
||||
from tkinter import ttk
|
||||
|
||||
|
@ -13,13 +14,13 @@ class EmaneInstallDialog(Dialog):
|
|||
def draw(self) -> None:
|
||||
self.top.columnconfigure(0, weight=1)
|
||||
label = ttk.Label(self.top, text="EMANE needs to be installed!")
|
||||
label.grid(sticky="ew", pady=PADY)
|
||||
label.grid(sticky=tk.EW, pady=PADY)
|
||||
button = ttk.Button(
|
||||
self.top, text="EMANE Documentation", command=self.click_doc
|
||||
)
|
||||
button.grid(sticky="ew", pady=PADY)
|
||||
button.grid(sticky=tk.EW, pady=PADY)
|
||||
button = ttk.Button(self.top, text="Close", command=self.destroy)
|
||||
button.grid(sticky="ew")
|
||||
button.grid(sticky=tk.EW)
|
||||
|
||||
def click_doc(self) -> None:
|
||||
webbrowser.open_new("https://coreemu.github.io/core/emane.html")
|
||||
|
|
|
@ -25,13 +25,13 @@ class ExecutePythonDialog(Dialog):
|
|||
frame = ttk.Frame(self.top, padding=FRAME_PAD)
|
||||
frame.columnconfigure(0, weight=1)
|
||||
frame.columnconfigure(1, weight=1)
|
||||
frame.grid(row=i, column=0, sticky="nsew")
|
||||
frame.grid(row=i, column=0, sticky=tk.NSEW)
|
||||
i = i + 1
|
||||
var = tk.StringVar(value="")
|
||||
self.file_entry = ttk.Entry(frame, textvariable=var)
|
||||
self.file_entry.grid(row=0, column=0, sticky="ew")
|
||||
self.file_entry.grid(row=0, column=0, sticky=tk.EW)
|
||||
button = ttk.Button(frame, text="...", command=self.select_file)
|
||||
button.grid(row=0, column=1, sticky="ew")
|
||||
button.grid(row=0, column=1, sticky=tk.EW)
|
||||
|
||||
self.top.columnconfigure(0, weight=1)
|
||||
button = ttk.Checkbutton(
|
||||
|
@ -40,18 +40,18 @@ class ExecutePythonDialog(Dialog):
|
|||
variable=self.with_options,
|
||||
command=self.add_options,
|
||||
)
|
||||
button.grid(row=i, column=0, sticky="ew")
|
||||
button.grid(row=i, column=0, sticky=tk.EW)
|
||||
i = i + 1
|
||||
|
||||
label = ttk.Label(
|
||||
self.top, text="Any command-line options for running the Python script"
|
||||
)
|
||||
label.grid(row=i, column=0, sticky="ew")
|
||||
label.grid(row=i, column=0, sticky=tk.EW)
|
||||
i = i + 1
|
||||
self.option_entry = ttk.Entry(
|
||||
self.top, textvariable=self.options, state="disabled"
|
||||
)
|
||||
self.option_entry.grid(row=i, column=0, sticky="ew")
|
||||
self.option_entry.grid(row=i, column=0, sticky=tk.EW)
|
||||
i = i + 1
|
||||
|
||||
frame = ttk.Frame(self.top, padding=FRAME_PAD)
|
||||
|
@ -59,9 +59,9 @@ class ExecutePythonDialog(Dialog):
|
|||
frame.columnconfigure(1, weight=1)
|
||||
frame.grid(row=i, column=0)
|
||||
button = ttk.Button(frame, text="Execute", command=self.script_execute)
|
||||
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", padx=PADX)
|
||||
button.grid(row=0, column=1, sticky=tk.EW, padx=PADX)
|
||||
|
||||
def add_options(self) -> None:
|
||||
if self.with_options.get():
|
||||
|
|
|
@ -25,25 +25,25 @@ class FindDialog(Dialog):
|
|||
|
||||
# Find node frame
|
||||
frame = ttk.Frame(self.top, padding=FRAME_PAD)
|
||||
frame.grid(sticky="ew", pady=PADY)
|
||||
frame.grid(sticky=tk.EW, pady=PADY)
|
||||
frame.columnconfigure(1, weight=1)
|
||||
label = ttk.Label(frame, text="Find:")
|
||||
label.grid()
|
||||
entry = ttk.Entry(frame, textvariable=self.find_text)
|
||||
entry.grid(row=0, column=1, sticky="nsew")
|
||||
entry.grid(row=0, column=1, sticky=tk.NSEW)
|
||||
|
||||
# node list frame
|
||||
frame = ttk.Frame(self.top)
|
||||
frame.columnconfigure(0, weight=1)
|
||||
frame.rowconfigure(0, weight=1)
|
||||
frame.grid(sticky="nsew", pady=PADY)
|
||||
frame.grid(sticky=tk.NSEW, pady=PADY)
|
||||
self.tree = ttk.Treeview(
|
||||
frame,
|
||||
columns=("nodeid", "name", "location", "detail"),
|
||||
show="headings",
|
||||
selectmode=tk.BROWSE,
|
||||
)
|
||||
self.tree.grid(sticky="nsew", pady=PADY)
|
||||
self.tree.grid(sticky=tk.NSEW, pady=PADY)
|
||||
style = ttk.Style()
|
||||
heading_size = int(self.app.guiconfig.scale * 10)
|
||||
style.configure("Treeview.Heading", font=(None, heading_size, "bold"))
|
||||
|
@ -57,21 +57,21 @@ class FindDialog(Dialog):
|
|||
self.tree.heading("detail", text="Detail")
|
||||
self.tree.bind("<<TreeviewSelect>>", self.click_select)
|
||||
yscrollbar = ttk.Scrollbar(frame, orient="vertical", command=self.tree.yview)
|
||||
yscrollbar.grid(row=0, column=1, sticky="ns")
|
||||
yscrollbar.grid(row=0, column=1, sticky=tk.NS)
|
||||
self.tree.configure(yscrollcommand=yscrollbar.set)
|
||||
xscrollbar = ttk.Scrollbar(frame, orient="horizontal", command=self.tree.xview)
|
||||
xscrollbar.grid(row=1, sticky="ew")
|
||||
xscrollbar.grid(row=1, sticky=tk.EW)
|
||||
self.tree.configure(xscrollcommand=xscrollbar.set)
|
||||
|
||||
# button frame
|
||||
frame = ttk.Frame(self.top)
|
||||
frame.grid(sticky="ew")
|
||||
frame.grid(sticky=tk.EW)
|
||||
frame.columnconfigure(0, weight=1)
|
||||
frame.columnconfigure(1, weight=1)
|
||||
button = ttk.Button(frame, text="Find", command=self.find_node)
|
||||
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.close_dialog)
|
||||
button.grid(row=0, column=1, sticky="ew")
|
||||
button.grid(row=0, column=1, sticky=tk.EW)
|
||||
|
||||
def clear_treeview_items(self) -> None:
|
||||
"""
|
||||
|
|
|
@ -27,14 +27,14 @@ class HookDialog(Dialog):
|
|||
|
||||
# name and states
|
||||
frame = ttk.Frame(self.top)
|
||||
frame.grid(sticky="ew", pady=PADY)
|
||||
frame.grid(sticky=tk.EW, pady=PADY)
|
||||
frame.columnconfigure(0, weight=2)
|
||||
frame.columnconfigure(1, weight=7)
|
||||
frame.columnconfigure(2, weight=1)
|
||||
label = ttk.Label(frame, text="Name")
|
||||
label.grid(row=0, column=0, sticky="ew", padx=PADX)
|
||||
label.grid(row=0, column=0, sticky=tk.EW, padx=PADX)
|
||||
entry = ttk.Entry(frame, textvariable=self.name)
|
||||
entry.grid(row=0, column=1, sticky="ew", padx=PADX)
|
||||
entry.grid(row=0, column=1, sticky=tk.EW, padx=PADX)
|
||||
values = tuple(x.name for x in SessionState)
|
||||
initial_state = SessionState.RUNTIME.name
|
||||
self.state.set(initial_state)
|
||||
|
@ -42,7 +42,7 @@ class HookDialog(Dialog):
|
|||
combobox = ttk.Combobox(
|
||||
frame, textvariable=self.state, values=values, state="readonly"
|
||||
)
|
||||
combobox.grid(row=0, column=2, sticky="ew")
|
||||
combobox.grid(row=0, column=2, sticky=tk.EW)
|
||||
combobox.bind("<<ComboboxSelected>>", self.state_change)
|
||||
|
||||
# data
|
||||
|
@ -55,17 +55,17 @@ class HookDialog(Dialog):
|
|||
"# specified state\n"
|
||||
),
|
||||
)
|
||||
self.codetext.grid(sticky="nsew", pady=PADY)
|
||||
self.codetext.grid(sticky=tk.NSEW, pady=PADY)
|
||||
|
||||
# button row
|
||||
frame = ttk.Frame(self.top)
|
||||
frame.grid(sticky="ew")
|
||||
frame.grid(sticky=tk.EW)
|
||||
for i in range(2):
|
||||
frame.columnconfigure(i, weight=1)
|
||||
button = ttk.Button(frame, text="Save", command=lambda: self.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=lambda: self.destroy())
|
||||
button.grid(row=0, column=1, sticky="ew")
|
||||
button.grid(row=0, column=1, sticky=tk.EW)
|
||||
|
||||
def state_change(self, event: tk.Event) -> None:
|
||||
if self.editing:
|
||||
|
@ -110,7 +110,7 @@ class HooksDialog(Dialog):
|
|||
self.top.rowconfigure(0, weight=1)
|
||||
|
||||
listbox_scroll = ListboxScroll(self.top)
|
||||
listbox_scroll.grid(sticky="nsew", pady=PADY)
|
||||
listbox_scroll.grid(sticky=tk.NSEW, pady=PADY)
|
||||
self.listbox = listbox_scroll.listbox
|
||||
self.listbox.bind("<<ListboxSelect>>", self.select)
|
||||
session = self.app.core.session
|
||||
|
@ -118,21 +118,21 @@ class HooksDialog(Dialog):
|
|||
self.listbox.insert(tk.END, file)
|
||||
|
||||
frame = ttk.Frame(self.top)
|
||||
frame.grid(sticky="ew")
|
||||
frame.grid(sticky=tk.EW)
|
||||
for i in range(4):
|
||||
frame.columnconfigure(i, weight=1)
|
||||
button = ttk.Button(frame, text="Create", command=self.click_create)
|
||||
button.grid(row=0, column=0, sticky="ew", padx=PADX)
|
||||
button.grid(row=0, column=0, sticky=tk.EW, padx=PADX)
|
||||
self.edit_button = ttk.Button(
|
||||
frame, text="Edit", state=tk.DISABLED, command=self.click_edit
|
||||
)
|
||||
self.edit_button.grid(row=0, column=1, sticky="ew", padx=PADX)
|
||||
self.edit_button.grid(row=0, column=1, sticky=tk.EW, padx=PADX)
|
||||
self.delete_button = ttk.Button(
|
||||
frame, text="Delete", state=tk.DISABLED, command=self.click_delete
|
||||
)
|
||||
self.delete_button.grid(row=0, column=2, sticky="ew", padx=PADX)
|
||||
self.delete_button.grid(row=0, column=2, sticky=tk.EW, padx=PADX)
|
||||
button = ttk.Button(frame, text="Cancel", command=lambda: self.destroy())
|
||||
button.grid(row=0, column=3, sticky="ew")
|
||||
button.grid(row=0, column=3, sticky=tk.EW)
|
||||
|
||||
def click_create(self) -> None:
|
||||
dialog = HookDialog(self, self.app)
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -73,11 +73,11 @@ class LinkConfigurationDialog(Dialog):
|
|||
label = ttk.Label(
|
||||
self.top, text=f"Link from {source_name} to {dest_name}", anchor=tk.CENTER
|
||||
)
|
||||
label.grid(row=0, column=0, sticky="ew", pady=PADY)
|
||||
label.grid(row=0, column=0, sticky=tk.EW, pady=PADY)
|
||||
|
||||
frame = ttk.Frame(self.top)
|
||||
frame.columnconfigure(0, weight=1)
|
||||
frame.grid(row=1, column=0, sticky="ew", pady=PADY)
|
||||
frame.grid(row=1, column=0, sticky=tk.EW, pady=PADY)
|
||||
if self.is_symmetric:
|
||||
button = ttk.Button(
|
||||
frame, textvariable=self.symmetry_var, command=self.change_symmetry
|
||||
|
@ -86,25 +86,25 @@ class LinkConfigurationDialog(Dialog):
|
|||
button = ttk.Button(
|
||||
frame, textvariable=self.symmetry_var, command=self.change_symmetry
|
||||
)
|
||||
button.grid(sticky="ew")
|
||||
button.grid(sticky=tk.EW)
|
||||
|
||||
if self.is_symmetric:
|
||||
self.symmetric_frame = self.get_frame()
|
||||
self.symmetric_frame.grid(row=2, column=0, sticky="ew", pady=PADY)
|
||||
self.symmetric_frame.grid(row=2, column=0, sticky=tk.EW, pady=PADY)
|
||||
else:
|
||||
self.asymmetric_frame = self.get_frame()
|
||||
self.asymmetric_frame.grid(row=2, column=0, sticky="ew", pady=PADY)
|
||||
self.asymmetric_frame.grid(row=2, column=0, sticky=tk.EW, pady=PADY)
|
||||
|
||||
self.draw_spacer(row=3)
|
||||
|
||||
frame = ttk.Frame(self.top)
|
||||
frame.columnconfigure(0, weight=1)
|
||||
frame.columnconfigure(1, weight=1)
|
||||
frame.grid(row=4, column=0, sticky="ew")
|
||||
frame.grid(row=4, column=0, sticky=tk.EW)
|
||||
button = ttk.Button(frame, text="Apply", command=self.click_apply)
|
||||
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 get_frame(self) -> ttk.Frame:
|
||||
frame = ttk.Frame(self.top)
|
||||
|
@ -115,76 +115,76 @@ class LinkConfigurationDialog(Dialog):
|
|||
label_name = "Asymmetric Effects: Downstream / Upstream "
|
||||
row = 0
|
||||
label = ttk.Label(frame, text=label_name, anchor=tk.CENTER)
|
||||
label.grid(row=row, column=0, columnspan=2, sticky="ew", pady=PADY)
|
||||
label.grid(row=row, column=0, columnspan=2, sticky=tk.EW, pady=PADY)
|
||||
row = row + 1
|
||||
|
||||
label = ttk.Label(frame, text="Bandwidth (bps)")
|
||||
label.grid(row=row, column=0, sticky="ew")
|
||||
label.grid(row=row, column=0, sticky=tk.EW)
|
||||
entry = validation.PositiveIntEntry(
|
||||
frame, empty_enabled=False, textvariable=self.bandwidth
|
||||
)
|
||||
entry.grid(row=row, column=1, sticky="ew", pady=PADY)
|
||||
entry.grid(row=row, column=1, sticky=tk.EW, pady=PADY)
|
||||
if not self.is_symmetric:
|
||||
entry = validation.PositiveIntEntry(
|
||||
frame, empty_enabled=False, textvariable=self.down_bandwidth
|
||||
)
|
||||
entry.grid(row=row, column=2, sticky="ew", pady=PADY)
|
||||
entry.grid(row=row, column=2, sticky=tk.EW, pady=PADY)
|
||||
row = row + 1
|
||||
|
||||
label = ttk.Label(frame, text="Delay (us)")
|
||||
label.grid(row=row, column=0, sticky="ew")
|
||||
label.grid(row=row, column=0, sticky=tk.EW)
|
||||
entry = validation.PositiveIntEntry(
|
||||
frame, empty_enabled=False, textvariable=self.delay
|
||||
)
|
||||
entry.grid(row=row, column=1, sticky="ew", pady=PADY)
|
||||
entry.grid(row=row, column=1, sticky=tk.EW, pady=PADY)
|
||||
if not self.is_symmetric:
|
||||
entry = validation.PositiveIntEntry(
|
||||
frame, empty_enabled=False, textvariable=self.down_delay
|
||||
)
|
||||
entry.grid(row=row, column=2, sticky="ew", pady=PADY)
|
||||
entry.grid(row=row, column=2, sticky=tk.EW, pady=PADY)
|
||||
row = row + 1
|
||||
|
||||
label = ttk.Label(frame, text="Jitter (us)")
|
||||
label.grid(row=row, column=0, sticky="ew")
|
||||
label.grid(row=row, column=0, sticky=tk.EW)
|
||||
entry = validation.PositiveIntEntry(
|
||||
frame, empty_enabled=False, textvariable=self.jitter
|
||||
)
|
||||
entry.grid(row=row, column=1, sticky="ew", pady=PADY)
|
||||
entry.grid(row=row, column=1, sticky=tk.EW, pady=PADY)
|
||||
if not self.is_symmetric:
|
||||
entry = validation.PositiveIntEntry(
|
||||
frame, empty_enabled=False, textvariable=self.down_jitter
|
||||
)
|
||||
entry.grid(row=row, column=2, sticky="ew", pady=PADY)
|
||||
entry.grid(row=row, column=2, sticky=tk.EW, pady=PADY)
|
||||
row = row + 1
|
||||
|
||||
label = ttk.Label(frame, text="Loss (%)")
|
||||
label.grid(row=row, column=0, sticky="ew")
|
||||
label.grid(row=row, column=0, sticky=tk.EW)
|
||||
entry = validation.PositiveFloatEntry(
|
||||
frame, empty_enabled=False, textvariable=self.loss
|
||||
)
|
||||
entry.grid(row=row, column=1, sticky="ew", pady=PADY)
|
||||
entry.grid(row=row, column=1, sticky=tk.EW, pady=PADY)
|
||||
if not self.is_symmetric:
|
||||
entry = validation.PositiveFloatEntry(
|
||||
frame, empty_enabled=False, textvariable=self.down_loss
|
||||
)
|
||||
entry.grid(row=row, column=2, sticky="ew", pady=PADY)
|
||||
entry.grid(row=row, column=2, sticky=tk.EW, pady=PADY)
|
||||
row = row + 1
|
||||
|
||||
label = ttk.Label(frame, text="Duplicate (%)")
|
||||
label.grid(row=row, column=0, sticky="ew")
|
||||
label.grid(row=row, column=0, sticky=tk.EW)
|
||||
entry = validation.PositiveIntEntry(
|
||||
frame, empty_enabled=False, textvariable=self.duplicate
|
||||
)
|
||||
entry.grid(row=row, column=1, sticky="ew", pady=PADY)
|
||||
entry.grid(row=row, column=1, sticky=tk.EW, pady=PADY)
|
||||
if not self.is_symmetric:
|
||||
entry = validation.PositiveIntEntry(
|
||||
frame, empty_enabled=False, textvariable=self.down_duplicate
|
||||
)
|
||||
entry.grid(row=row, column=2, sticky="ew", pady=PADY)
|
||||
entry.grid(row=row, column=2, sticky=tk.EW, pady=PADY)
|
||||
row = row + 1
|
||||
|
||||
label = ttk.Label(frame, text="Color")
|
||||
label.grid(row=row, column=0, sticky="ew")
|
||||
label.grid(row=row, column=0, sticky=tk.EW)
|
||||
self.color_button = tk.Button(
|
||||
frame,
|
||||
textvariable=self.color,
|
||||
|
@ -194,15 +194,15 @@ class LinkConfigurationDialog(Dialog):
|
|||
highlightthickness=0,
|
||||
command=self.click_color,
|
||||
)
|
||||
self.color_button.grid(row=row, column=1, sticky="ew", pady=PADY)
|
||||
self.color_button.grid(row=row, column=1, sticky=tk.EW, pady=PADY)
|
||||
row = row + 1
|
||||
|
||||
label = ttk.Label(frame, text="Width")
|
||||
label.grid(row=row, column=0, sticky="ew")
|
||||
label.grid(row=row, column=0, sticky=tk.EW)
|
||||
entry = validation.PositiveFloatEntry(
|
||||
frame, empty_enabled=False, textvariable=self.width
|
||||
)
|
||||
entry.grid(row=row, column=1, sticky="ew", pady=PADY)
|
||||
entry.grid(row=row, column=1, sticky=tk.EW, pady=PADY)
|
||||
|
||||
return frame
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ class MacConfigDialog(Dialog):
|
|||
"provided value below and increment by value in order."
|
||||
)
|
||||
label = ttk.Label(self.top, text=text)
|
||||
label.grid(sticky="ew", pady=PADY)
|
||||
label.grid(sticky=tk.EW, pady=PADY)
|
||||
|
||||
# draw input
|
||||
frame = ttk.Frame(self.top)
|
||||
|
@ -36,9 +36,9 @@ class MacConfigDialog(Dialog):
|
|||
frame.columnconfigure(1, weight=3)
|
||||
frame.grid(stick="ew", pady=PADY)
|
||||
label = ttk.Label(frame, text="Starting MAC")
|
||||
label.grid(row=0, column=0, sticky="ew", padx=PADX)
|
||||
label.grid(row=0, column=0, sticky=tk.EW, padx=PADX)
|
||||
entry = ttk.Entry(frame, textvariable=self.mac_var)
|
||||
entry.grid(row=0, column=1, sticky="ew")
|
||||
entry.grid(row=0, column=1, sticky=tk.EW)
|
||||
|
||||
# draw buttons
|
||||
frame = ttk.Frame(self.top)
|
||||
|
@ -46,9 +46,9 @@ class MacConfigDialog(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_save(self) -> None:
|
||||
mac = self.mac_var.get()
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
"""
|
||||
mobility configuration
|
||||
"""
|
||||
import tkinter as tk
|
||||
from tkinter import ttk
|
||||
from typing import TYPE_CHECKING, Dict, Optional
|
||||
|
||||
|
@ -37,20 +38,20 @@ class MobilityConfigDialog(Dialog):
|
|||
self.top.rowconfigure(0, weight=1)
|
||||
self.config_frame = ConfigFrame(self.top, self.app, self.config)
|
||||
self.config_frame.draw_config()
|
||||
self.config_frame.grid(sticky="nsew", pady=PADY)
|
||||
self.config_frame.grid(sticky=tk.NSEW, pady=PADY)
|
||||
self.draw_apply_buttons()
|
||||
|
||||
def draw_apply_buttons(self) -> None:
|
||||
frame = ttk.Frame(self.top)
|
||||
frame.grid(sticky="ew")
|
||||
frame.grid(sticky=tk.EW)
|
||||
for i in range(2):
|
||||
frame.columnconfigure(i, weight=1)
|
||||
|
||||
button = ttk.Button(frame, text="Apply", command=self.click_apply)
|
||||
button.grid(row=0, column=0, padx=PADX, sticky="ew")
|
||||
button.grid(row=0, column=0, padx=PADX, sticky=tk.EW)
|
||||
|
||||
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_apply(self) -> None:
|
||||
self.config_frame.parse_config()
|
||||
|
|
|
@ -74,30 +74,30 @@ class MobilityPlayerDialog(Dialog):
|
|||
|
||||
file_name = config["file"].value
|
||||
label = ttk.Label(self.top, text=file_name)
|
||||
label.grid(sticky="ew", pady=PADY)
|
||||
label.grid(sticky=tk.EW, pady=PADY)
|
||||
|
||||
self.progressbar = ttk.Progressbar(self.top, mode="indeterminate")
|
||||
self.progressbar.grid(sticky="ew", pady=PADY)
|
||||
self.progressbar.grid(sticky=tk.EW, pady=PADY)
|
||||
|
||||
frame = ttk.Frame(self.top)
|
||||
frame.grid(sticky="ew", pady=PADY)
|
||||
frame.grid(sticky=tk.EW, pady=PADY)
|
||||
for i in range(3):
|
||||
frame.columnconfigure(i, weight=1)
|
||||
|
||||
image = self.app.get_icon(ImageEnum.START, ICON_SIZE)
|
||||
self.play_button = ttk.Button(frame, image=image, command=self.click_play)
|
||||
self.play_button.image = image
|
||||
self.play_button.grid(row=0, column=0, sticky="ew", padx=PADX)
|
||||
self.play_button.grid(row=0, column=0, sticky=tk.EW, padx=PADX)
|
||||
|
||||
image = self.app.get_icon(ImageEnum.PAUSE, ICON_SIZE)
|
||||
self.pause_button = ttk.Button(frame, image=image, command=self.click_pause)
|
||||
self.pause_button.image = image
|
||||
self.pause_button.grid(row=0, column=1, sticky="ew", padx=PADX)
|
||||
self.pause_button.grid(row=0, column=1, sticky=tk.EW, padx=PADX)
|
||||
|
||||
image = self.app.get_icon(ImageEnum.STOP, ICON_SIZE)
|
||||
self.stop_button = ttk.Button(frame, image=image, command=self.click_stop)
|
||||
self.stop_button.image = image
|
||||
self.stop_button.grid(row=0, column=2, sticky="ew", padx=PADX)
|
||||
self.stop_button.grid(row=0, column=2, sticky=tk.EW, padx=PADX)
|
||||
|
||||
loop = tk.IntVar(value=int(config["loop"].value == "1"))
|
||||
checkbutton = ttk.Checkbutton(
|
||||
|
|
|
@ -126,12 +126,12 @@ class NodeConfigDialog(Dialog):
|
|||
|
||||
# field frame
|
||||
frame = ttk.Frame(self.top)
|
||||
frame.grid(sticky="ew")
|
||||
frame.grid(sticky=tk.EW)
|
||||
frame.columnconfigure(1, weight=1)
|
||||
|
||||
# icon field
|
||||
label = ttk.Label(frame, text="Icon")
|
||||
label.grid(row=row, column=0, sticky="ew", padx=PADX, pady=PADY)
|
||||
label.grid(row=row, column=0, sticky=tk.EW, padx=PADX, pady=PADY)
|
||||
self.image_button = ttk.Button(
|
||||
frame,
|
||||
text="Icon",
|
||||
|
@ -139,49 +139,49 @@ class NodeConfigDialog(Dialog):
|
|||
compound=tk.NONE,
|
||||
command=self.click_icon,
|
||||
)
|
||||
self.image_button.grid(row=row, column=1, sticky="ew")
|
||||
self.image_button.grid(row=row, column=1, sticky=tk.EW)
|
||||
row += 1
|
||||
|
||||
# name field
|
||||
label = ttk.Label(frame, text="Name")
|
||||
label.grid(row=row, column=0, sticky="ew", padx=PADX, pady=PADY)
|
||||
label.grid(row=row, column=0, sticky=tk.EW, padx=PADX, pady=PADY)
|
||||
entry = validation.NodeNameEntry(frame, textvariable=self.name, state=state)
|
||||
entry.grid(row=row, column=1, sticky="ew")
|
||||
entry.grid(row=row, column=1, sticky=tk.EW)
|
||||
row += 1
|
||||
|
||||
# node type field
|
||||
if NodeUtils.is_model_node(self.node.type):
|
||||
label = ttk.Label(frame, text="Type")
|
||||
label.grid(row=row, column=0, sticky="ew", padx=PADX, pady=PADY)
|
||||
label.grid(row=row, column=0, sticky=tk.EW, padx=PADX, pady=PADY)
|
||||
combobox = ttk.Combobox(
|
||||
frame,
|
||||
textvariable=self.type,
|
||||
values=list(NodeUtils.NODE_MODELS),
|
||||
state=combo_state,
|
||||
)
|
||||
combobox.grid(row=row, column=1, sticky="ew")
|
||||
combobox.grid(row=row, column=1, sticky=tk.EW)
|
||||
row += 1
|
||||
|
||||
# container image field
|
||||
if NodeUtils.is_image_node(self.node.type):
|
||||
label = ttk.Label(frame, text="Image")
|
||||
label.grid(row=row, column=0, sticky="ew", padx=PADX, pady=PADY)
|
||||
label.grid(row=row, column=0, sticky=tk.EW, padx=PADX, pady=PADY)
|
||||
entry = ttk.Entry(frame, textvariable=self.container_image, state=state)
|
||||
entry.grid(row=row, column=1, sticky="ew")
|
||||
entry.grid(row=row, column=1, sticky=tk.EW)
|
||||
row += 1
|
||||
|
||||
if NodeUtils.is_container_node(self.node.type):
|
||||
# server
|
||||
frame.grid(sticky="ew")
|
||||
frame.grid(sticky=tk.EW)
|
||||
frame.columnconfigure(1, weight=1)
|
||||
label = ttk.Label(frame, text="Server")
|
||||
label.grid(row=row, column=0, sticky="ew", padx=PADX, pady=PADY)
|
||||
label.grid(row=row, column=0, sticky=tk.EW, padx=PADX, pady=PADY)
|
||||
servers = ["localhost"]
|
||||
servers.extend(list(sorted(self.app.core.servers.keys())))
|
||||
combobox = ttk.Combobox(
|
||||
frame, textvariable=self.server, values=servers, state=combo_state
|
||||
)
|
||||
combobox.grid(row=row, column=1, sticky="ew")
|
||||
combobox.grid(row=row, column=1, sticky=tk.EW)
|
||||
row += 1
|
||||
|
||||
if NodeUtils.is_rj45_node(self.node.type):
|
||||
|
@ -190,7 +190,7 @@ class NodeConfigDialog(Dialog):
|
|||
ifaces = ListboxScroll(frame)
|
||||
ifaces.listbox.config(state=state)
|
||||
ifaces.grid(
|
||||
row=row, column=0, columnspan=2, sticky="ew", padx=PADX, pady=PADY
|
||||
row=row, column=0, columnspan=2, sticky=tk.EW, padx=PADX, pady=PADY
|
||||
)
|
||||
for inf in sorted(response.ifaces[:]):
|
||||
ifaces.listbox.insert(tk.END, inf)
|
||||
|
@ -206,13 +206,13 @@ class NodeConfigDialog(Dialog):
|
|||
|
||||
def draw_ifaces(self) -> None:
|
||||
notebook = ttk.Notebook(self.top)
|
||||
notebook.grid(sticky="nsew", pady=PADY)
|
||||
notebook.grid(sticky=tk.NSEW, pady=PADY)
|
||||
self.top.rowconfigure(notebook.grid_info()["row"], weight=1)
|
||||
state = tk.DISABLED if self.app.core.is_runtime() else tk.NORMAL
|
||||
for iface_id in sorted(self.canvas_node.ifaces):
|
||||
iface = self.canvas_node.ifaces[iface_id]
|
||||
tab = ttk.Frame(notebook, padding=FRAME_PAD)
|
||||
tab.grid(sticky="nsew", pady=PADY)
|
||||
tab.grid(sticky=tk.NSEW, pady=PADY)
|
||||
tab.columnconfigure(1, weight=1)
|
||||
tab.columnconfigure(2, weight=1)
|
||||
notebook.add(tab, text=iface.name)
|
||||
|
@ -226,7 +226,7 @@ class NodeConfigDialog(Dialog):
|
|||
text=f"Configure EMANE {emane_model}",
|
||||
command=lambda: self.click_emane_config(emane_model, iface.id),
|
||||
)
|
||||
button.grid(row=row, sticky="ew", columnspan=3, pady=PADY)
|
||||
button.grid(row=row, sticky=tk.EW, columnspan=3, pady=PADY)
|
||||
row += 1
|
||||
|
||||
label = ttk.Label(tab, text="MAC")
|
||||
|
@ -243,7 +243,7 @@ class NodeConfigDialog(Dialog):
|
|||
checkbutton.grid(row=row, column=1, padx=PADX)
|
||||
mac = tk.StringVar(value=iface.mac)
|
||||
entry = ttk.Entry(tab, textvariable=mac, state=mac_state)
|
||||
entry.grid(row=row, column=2, sticky="ew")
|
||||
entry.grid(row=row, column=2, sticky=tk.EW)
|
||||
func = partial(mac_auto, is_auto, entry, mac)
|
||||
checkbutton.config(command=func)
|
||||
row += 1
|
||||
|
@ -255,7 +255,7 @@ class NodeConfigDialog(Dialog):
|
|||
ip4_net = f"{iface.ip4}/{iface.ip4_mask}"
|
||||
ip4 = tk.StringVar(value=ip4_net)
|
||||
entry = ttk.Entry(tab, textvariable=ip4, state=state)
|
||||
entry.grid(row=row, column=1, columnspan=2, sticky="ew")
|
||||
entry.grid(row=row, column=1, columnspan=2, sticky=tk.EW)
|
||||
row += 1
|
||||
|
||||
label = ttk.Label(tab, text="IPv6")
|
||||
|
@ -265,21 +265,21 @@ class NodeConfigDialog(Dialog):
|
|||
ip6_net = f"{iface.ip6}/{iface.ip6_mask}"
|
||||
ip6 = tk.StringVar(value=ip6_net)
|
||||
entry = ttk.Entry(tab, textvariable=ip6, state=state)
|
||||
entry.grid(row=row, column=1, columnspan=2, sticky="ew")
|
||||
entry.grid(row=row, column=1, columnspan=2, sticky=tk.EW)
|
||||
|
||||
self.ifaces[iface.id] = InterfaceData(is_auto, mac, ip4, ip6)
|
||||
|
||||
def draw_buttons(self) -> None:
|
||||
frame = ttk.Frame(self.top)
|
||||
frame.grid(sticky="ew")
|
||||
frame.grid(sticky=tk.EW)
|
||||
frame.columnconfigure(0, weight=1)
|
||||
frame.columnconfigure(1, weight=1)
|
||||
|
||||
button = ttk.Button(frame, text="Apply", command=self.click_apply)
|
||||
button.grid(row=0, column=0, padx=PADX, sticky="ew")
|
||||
button.grid(row=0, column=0, padx=PADX, sticky=tk.EW)
|
||||
|
||||
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_emane_config(self, emane_model: str, iface_id: int) -> None:
|
||||
dialog = EmaneModelDialog(
|
||||
|
|
|
@ -41,32 +41,32 @@ class NodeConfigServiceDialog(Dialog):
|
|||
for i in range(3):
|
||||
frame.columnconfigure(i, weight=1)
|
||||
label_frame = ttk.LabelFrame(frame, text="Groups", padding=FRAME_PAD)
|
||||
label_frame.grid(row=0, column=0, sticky="nsew")
|
||||
label_frame.grid(row=0, column=0, sticky=tk.NSEW)
|
||||
label_frame.rowconfigure(0, weight=1)
|
||||
label_frame.columnconfigure(0, weight=1)
|
||||
self.groups = ListboxScroll(label_frame)
|
||||
self.groups.grid(sticky="nsew")
|
||||
self.groups.grid(sticky=tk.NSEW)
|
||||
for group in sorted(self.app.core.config_services_groups):
|
||||
self.groups.listbox.insert(tk.END, group)
|
||||
self.groups.listbox.bind("<<ListboxSelect>>", self.handle_group_change)
|
||||
self.groups.listbox.selection_set(0)
|
||||
|
||||
label_frame = ttk.LabelFrame(frame, text="Services")
|
||||
label_frame.grid(row=0, column=1, sticky="nsew")
|
||||
label_frame.grid(row=0, column=1, sticky=tk.NSEW)
|
||||
label_frame.columnconfigure(0, weight=1)
|
||||
label_frame.rowconfigure(0, weight=1)
|
||||
self.services = CheckboxList(
|
||||
label_frame, self.app, clicked=self.service_clicked, padding=FRAME_PAD
|
||||
)
|
||||
self.services.grid(sticky="nsew")
|
||||
self.services.grid(sticky=tk.NSEW)
|
||||
|
||||
label_frame = ttk.LabelFrame(frame, text="Selected", padding=FRAME_PAD)
|
||||
label_frame.grid(row=0, column=2, sticky="nsew")
|
||||
label_frame.grid(row=0, column=2, sticky=tk.NSEW)
|
||||
label_frame.rowconfigure(0, weight=1)
|
||||
label_frame.columnconfigure(0, weight=1)
|
||||
|
||||
self.current = ListboxScroll(label_frame)
|
||||
self.current.grid(sticky="nsew")
|
||||
self.current.grid(sticky=tk.NSEW)
|
||||
self.draw_current_services()
|
||||
|
||||
frame = ttk.Frame(self.top)
|
||||
|
@ -74,13 +74,13 @@ class NodeConfigServiceDialog(Dialog):
|
|||
for i in range(4):
|
||||
frame.columnconfigure(i, weight=1)
|
||||
button = ttk.Button(frame, text="Configure", command=self.click_configure)
|
||||
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="Save", command=self.click_save)
|
||||
button.grid(row=0, column=1, sticky="ew", padx=PADX)
|
||||
button.grid(row=0, column=1, sticky=tk.EW, padx=PADX)
|
||||
button = ttk.Button(frame, text="Remove", command=self.click_remove)
|
||||
button.grid(row=0, column=2, sticky="ew", padx=PADX)
|
||||
button.grid(row=0, column=2, sticky=tk.EW, padx=PADX)
|
||||
button = ttk.Button(frame, text="Cancel", command=self.click_cancel)
|
||||
button.grid(row=0, column=3, sticky="ew")
|
||||
button.grid(row=0, column=3, sticky=tk.EW)
|
||||
|
||||
# trigger group change
|
||||
self.handle_group_change()
|
||||
|
|
|
@ -37,31 +37,31 @@ class NodeServiceDialog(Dialog):
|
|||
for i in range(3):
|
||||
frame.columnconfigure(i, weight=1)
|
||||
label_frame = ttk.LabelFrame(frame, text="Groups", padding=FRAME_PAD)
|
||||
label_frame.grid(row=0, column=0, sticky="nsew")
|
||||
label_frame.grid(row=0, column=0, sticky=tk.NSEW)
|
||||
label_frame.rowconfigure(0, weight=1)
|
||||
label_frame.columnconfigure(0, weight=1)
|
||||
self.groups = ListboxScroll(label_frame)
|
||||
self.groups.grid(sticky="nsew")
|
||||
self.groups.grid(sticky=tk.NSEW)
|
||||
for group in sorted(self.app.core.services):
|
||||
self.groups.listbox.insert(tk.END, group)
|
||||
self.groups.listbox.bind("<<ListboxSelect>>", self.handle_group_change)
|
||||
self.groups.listbox.selection_set(0)
|
||||
|
||||
label_frame = ttk.LabelFrame(frame, text="Services")
|
||||
label_frame.grid(row=0, column=1, sticky="nsew")
|
||||
label_frame.grid(row=0, column=1, sticky=tk.NSEW)
|
||||
label_frame.columnconfigure(0, weight=1)
|
||||
label_frame.rowconfigure(0, weight=1)
|
||||
self.services = CheckboxList(
|
||||
label_frame, self.app, clicked=self.service_clicked, padding=FRAME_PAD
|
||||
)
|
||||
self.services.grid(sticky="nsew")
|
||||
self.services.grid(sticky=tk.NSEW)
|
||||
|
||||
label_frame = ttk.LabelFrame(frame, text="Selected", padding=FRAME_PAD)
|
||||
label_frame.grid(row=0, column=2, sticky="nsew")
|
||||
label_frame.grid(row=0, column=2, sticky=tk.NSEW)
|
||||
label_frame.rowconfigure(0, weight=1)
|
||||
label_frame.columnconfigure(0, weight=1)
|
||||
self.current = ListboxScroll(label_frame)
|
||||
self.current.grid(sticky="nsew")
|
||||
self.current.grid(sticky=tk.NSEW)
|
||||
for service in sorted(self.current_services):
|
||||
self.current.listbox.insert(tk.END, service)
|
||||
if self.is_custom_service(service):
|
||||
|
@ -72,13 +72,13 @@ class NodeServiceDialog(Dialog):
|
|||
for i in range(4):
|
||||
frame.columnconfigure(i, weight=1)
|
||||
button = ttk.Button(frame, text="Configure", command=self.click_configure)
|
||||
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="Save", command=self.click_save)
|
||||
button.grid(row=0, column=1, sticky="ew", padx=PADX)
|
||||
button.grid(row=0, column=1, sticky=tk.EW, padx=PADX)
|
||||
button = ttk.Button(frame, text="Remove", command=self.click_remove)
|
||||
button.grid(row=0, column=2, sticky="ew", padx=PADX)
|
||||
button.grid(row=0, column=2, sticky=tk.EW, padx=PADX)
|
||||
button = ttk.Button(frame, text="Cancel", command=self.destroy)
|
||||
button.grid(row=0, column=3, sticky="ew")
|
||||
button.grid(row=0, column=3, sticky=tk.EW)
|
||||
|
||||
# trigger group change
|
||||
self.handle_group_change()
|
||||
|
|
|
@ -33,60 +33,60 @@ class ObserverDialog(Dialog):
|
|||
|
||||
def draw_listbox(self) -> None:
|
||||
listbox_scroll = ListboxScroll(self.top)
|
||||
listbox_scroll.grid(sticky="nsew", pady=PADY)
|
||||
listbox_scroll.grid(sticky=tk.NSEW, pady=PADY)
|
||||
listbox_scroll.columnconfigure(0, weight=1)
|
||||
listbox_scroll.rowconfigure(0, weight=1)
|
||||
self.observers = listbox_scroll.listbox
|
||||
self.observers.grid(row=0, column=0, sticky="nsew")
|
||||
self.observers.grid(row=0, column=0, sticky=tk.NSEW)
|
||||
self.observers.bind("<<ListboxSelect>>", self.handle_observer_change)
|
||||
for name in sorted(self.app.core.custom_observers):
|
||||
self.observers.insert(tk.END, name)
|
||||
|
||||
def draw_form_fields(self) -> None:
|
||||
frame = ttk.Frame(self.top)
|
||||
frame.grid(sticky="ew", pady=PADY)
|
||||
frame.grid(sticky=tk.EW, pady=PADY)
|
||||
frame.columnconfigure(1, weight=1)
|
||||
|
||||
label = ttk.Label(frame, text="Name")
|
||||
label.grid(row=0, column=0, sticky="w", padx=PADX)
|
||||
label.grid(row=0, column=0, sticky=tk.W, padx=PADX)
|
||||
entry = ttk.Entry(frame, textvariable=self.name)
|
||||
entry.grid(row=0, column=1, sticky="ew")
|
||||
entry.grid(row=0, column=1, sticky=tk.EW)
|
||||
|
||||
label = ttk.Label(frame, text="Command")
|
||||
label.grid(row=1, column=0, sticky="w", padx=PADX)
|
||||
label.grid(row=1, column=0, sticky=tk.W, padx=PADX)
|
||||
entry = ttk.Entry(frame, textvariable=self.cmd)
|
||||
entry.grid(row=1, column=1, sticky="ew")
|
||||
entry.grid(row=1, column=1, sticky=tk.EW)
|
||||
|
||||
def draw_config_buttons(self) -> None:
|
||||
frame = ttk.Frame(self.top)
|
||||
frame.grid(sticky="ew", pady=PADY)
|
||||
frame.grid(sticky=tk.EW, pady=PADY)
|
||||
for i in range(3):
|
||||
frame.columnconfigure(i, weight=1)
|
||||
|
||||
button = ttk.Button(frame, text="Create", command=self.click_create)
|
||||
button.grid(row=0, column=0, sticky="ew", padx=PADX)
|
||||
button.grid(row=0, column=0, sticky=tk.EW, padx=PADX)
|
||||
|
||||
self.save_button = ttk.Button(
|
||||
frame, text="Save", state=tk.DISABLED, command=self.click_save
|
||||
)
|
||||
self.save_button.grid(row=0, column=1, sticky="ew", padx=PADX)
|
||||
self.save_button.grid(row=0, column=1, sticky=tk.EW, padx=PADX)
|
||||
|
||||
self.delete_button = ttk.Button(
|
||||
frame, text="Delete", state=tk.DISABLED, command=self.click_delete
|
||||
)
|
||||
self.delete_button.grid(row=0, column=2, sticky="ew")
|
||||
self.delete_button.grid(row=0, column=2, sticky=tk.EW)
|
||||
|
||||
def draw_apply_buttons(self) -> None:
|
||||
frame = ttk.Frame(self.top)
|
||||
frame.grid(sticky="ew")
|
||||
frame.grid(sticky=tk.EW)
|
||||
for i in range(2):
|
||||
frame.columnconfigure(i, weight=1)
|
||||
|
||||
button = ttk.Button(frame, text="Save", command=self.click_save_config)
|
||||
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_save_config(self) -> None:
|
||||
self.app.guiconfig.observers.clear()
|
||||
|
|
|
@ -34,42 +34,42 @@ class PreferencesDialog(Dialog):
|
|||
|
||||
def draw_preferences(self) -> None:
|
||||
frame = ttk.LabelFrame(self.top, text="Preferences", padding=FRAME_PAD)
|
||||
frame.grid(sticky="nsew", pady=PADY)
|
||||
frame.grid(sticky=tk.NSEW, pady=PADY)
|
||||
frame.columnconfigure(1, weight=1)
|
||||
|
||||
label = ttk.Label(frame, text="Theme")
|
||||
label.grid(row=0, column=0, pady=PADY, padx=PADX, sticky="w")
|
||||
label.grid(row=0, column=0, pady=PADY, padx=PADX, sticky=tk.W)
|
||||
themes = self.app.style.theme_names()
|
||||
combobox = ttk.Combobox(
|
||||
frame, textvariable=self.theme, values=themes, state="readonly"
|
||||
)
|
||||
combobox.set(self.theme.get())
|
||||
combobox.grid(row=0, column=1, sticky="ew")
|
||||
combobox.grid(row=0, column=1, sticky=tk.EW)
|
||||
combobox.bind("<<ComboboxSelected>>", self.theme_change)
|
||||
|
||||
label = ttk.Label(frame, text="Editor")
|
||||
label.grid(row=1, column=0, pady=PADY, padx=PADX, sticky="w")
|
||||
label.grid(row=1, column=0, pady=PADY, padx=PADX, sticky=tk.W)
|
||||
combobox = ttk.Combobox(
|
||||
frame, textvariable=self.editor, values=appconfig.EDITORS, state="readonly"
|
||||
)
|
||||
combobox.grid(row=1, column=1, sticky="ew")
|
||||
combobox.grid(row=1, column=1, sticky=tk.EW)
|
||||
|
||||
label = ttk.Label(frame, text="Terminal")
|
||||
label.grid(row=2, column=0, pady=PADY, padx=PADX, sticky="w")
|
||||
label.grid(row=2, column=0, pady=PADY, padx=PADX, sticky=tk.W)
|
||||
terminals = sorted(appconfig.TERMINALS.values())
|
||||
combobox = ttk.Combobox(frame, textvariable=self.terminal, values=terminals)
|
||||
combobox.grid(row=2, column=1, sticky="ew")
|
||||
combobox.grid(row=2, column=1, sticky=tk.EW)
|
||||
|
||||
label = ttk.Label(frame, text="3D GUI")
|
||||
label.grid(row=3, column=0, pady=PADY, padx=PADX, sticky="w")
|
||||
label.grid(row=3, column=0, pady=PADY, padx=PADX, sticky=tk.W)
|
||||
entry = ttk.Entry(frame, textvariable=self.gui3d)
|
||||
entry.grid(row=3, column=1, sticky="ew")
|
||||
entry.grid(row=3, column=1, sticky=tk.EW)
|
||||
|
||||
label = ttk.Label(frame, text="Scaling")
|
||||
label.grid(row=4, column=0, pady=PADY, padx=PADX, sticky="w")
|
||||
label.grid(row=4, column=0, pady=PADY, padx=PADX, sticky=tk.W)
|
||||
|
||||
scale_frame = ttk.Frame(frame)
|
||||
scale_frame.grid(row=4, column=1, sticky="ew")
|
||||
scale_frame.grid(row=4, column=1, sticky=tk.EW)
|
||||
scale_frame.columnconfigure(0, weight=1)
|
||||
scale = ttk.Scale(
|
||||
scale_frame,
|
||||
|
@ -79,7 +79,7 @@ class PreferencesDialog(Dialog):
|
|||
orient=tk.HORIZONTAL,
|
||||
variable=self.gui_scale,
|
||||
)
|
||||
scale.grid(row=0, column=0, sticky="ew")
|
||||
scale.grid(row=0, column=0, sticky=tk.EW)
|
||||
entry = validation.AppScaleEntry(
|
||||
scale_frame, textvariable=self.gui_scale, width=4
|
||||
)
|
||||
|
@ -90,15 +90,15 @@ class PreferencesDialog(Dialog):
|
|||
|
||||
def draw_buttons(self) -> None:
|
||||
frame = ttk.Frame(self.top)
|
||||
frame.grid(sticky="ew")
|
||||
frame.grid(sticky=tk.EW)
|
||||
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 theme_change(self, event: tk.Event) -> None:
|
||||
theme = self.theme.get()
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -37,12 +37,12 @@ class ServersDialog(Dialog):
|
|||
|
||||
def draw_servers(self) -> None:
|
||||
listbox_scroll = ListboxScroll(self.top)
|
||||
listbox_scroll.grid(pady=PADY, sticky="nsew")
|
||||
listbox_scroll.grid(pady=PADY, sticky=tk.NSEW)
|
||||
listbox_scroll.columnconfigure(0, weight=1)
|
||||
listbox_scroll.rowconfigure(0, weight=1)
|
||||
|
||||
self.servers = listbox_scroll.listbox
|
||||
self.servers.grid(row=0, column=0, sticky="nsew")
|
||||
self.servers.grid(row=0, column=0, sticky=tk.NSEW)
|
||||
self.servers.bind("<<ListboxSelect>>", self.handle_server_change)
|
||||
|
||||
for server in self.app.core.servers:
|
||||
|
@ -50,52 +50,52 @@ class ServersDialog(Dialog):
|
|||
|
||||
def draw_server_configuration(self) -> None:
|
||||
frame = ttk.LabelFrame(self.top, text="Server Configuration", padding=FRAME_PAD)
|
||||
frame.grid(pady=PADY, sticky="ew")
|
||||
frame.grid(pady=PADY, sticky=tk.EW)
|
||||
frame.columnconfigure(1, weight=1)
|
||||
frame.columnconfigure(3, weight=1)
|
||||
|
||||
label = ttk.Label(frame, text="Name")
|
||||
label.grid(row=0, column=0, sticky="w", padx=PADX)
|
||||
label.grid(row=0, column=0, sticky=tk.W, padx=PADX)
|
||||
entry = ttk.Entry(frame, textvariable=self.name)
|
||||
entry.grid(row=0, column=1, sticky="ew")
|
||||
entry.grid(row=0, column=1, sticky=tk.EW)
|
||||
|
||||
label = ttk.Label(frame, text="Address")
|
||||
label.grid(row=0, column=2, sticky="w", padx=PADX)
|
||||
label.grid(row=0, column=2, sticky=tk.W, padx=PADX)
|
||||
entry = ttk.Entry(frame, textvariable=self.address)
|
||||
entry.grid(row=0, column=3, sticky="ew")
|
||||
entry.grid(row=0, column=3, sticky=tk.EW)
|
||||
|
||||
def draw_servers_buttons(self) -> None:
|
||||
frame = ttk.Frame(self.top)
|
||||
frame.grid(pady=PADY, sticky="ew")
|
||||
frame.grid(pady=PADY, sticky=tk.EW)
|
||||
for i in range(3):
|
||||
frame.columnconfigure(i, weight=1)
|
||||
|
||||
button = ttk.Button(frame, text="Create", command=self.click_create)
|
||||
button.grid(row=0, column=0, sticky="ew", padx=PADX)
|
||||
button.grid(row=0, column=0, sticky=tk.EW, padx=PADX)
|
||||
|
||||
self.save_button = ttk.Button(
|
||||
frame, text="Save", state=tk.DISABLED, command=self.click_save
|
||||
)
|
||||
self.save_button.grid(row=0, column=1, sticky="ew", padx=PADX)
|
||||
self.save_button.grid(row=0, column=1, sticky=tk.EW, padx=PADX)
|
||||
|
||||
self.delete_button = ttk.Button(
|
||||
frame, text="Delete", state=tk.DISABLED, command=self.click_delete
|
||||
)
|
||||
self.delete_button.grid(row=0, column=2, sticky="ew")
|
||||
self.delete_button.grid(row=0, column=2, sticky=tk.EW)
|
||||
|
||||
def draw_apply_buttons(self) -> None:
|
||||
frame = ttk.Frame(self.top)
|
||||
frame.grid(sticky="ew")
|
||||
frame.grid(sticky=tk.EW)
|
||||
for i in range(2):
|
||||
frame.columnconfigure(i, weight=1)
|
||||
|
||||
button = ttk.Button(
|
||||
frame, text="Save Configuration", command=self.click_save_configuration
|
||||
)
|
||||
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_save_configuration(self):
|
||||
self.app.guiconfig.servers.clear()
|
||||
|
|
|
@ -119,16 +119,16 @@ class ServiceConfigDialog(Dialog):
|
|||
|
||||
# draw metadata
|
||||
frame = ttk.Frame(self.top)
|
||||
frame.grid(sticky="ew", pady=PADY)
|
||||
frame.grid(sticky=tk.EW, pady=PADY)
|
||||
frame.columnconfigure(1, weight=1)
|
||||
label = ttk.Label(frame, text="Meta-data")
|
||||
label.grid(row=0, column=0, sticky="w", padx=PADX)
|
||||
label.grid(row=0, column=0, sticky=tk.W, padx=PADX)
|
||||
self.metadata_entry = ttk.Entry(frame, textvariable=self.metadata)
|
||||
self.metadata_entry.grid(row=0, column=1, sticky="ew")
|
||||
self.metadata_entry.grid(row=0, column=1, sticky=tk.EW)
|
||||
|
||||
# draw notebook
|
||||
self.notebook = ttk.Notebook(self.top)
|
||||
self.notebook.grid(sticky="nsew", pady=PADY)
|
||||
self.notebook.grid(sticky=tk.NSEW, pady=PADY)
|
||||
self.draw_tab_files()
|
||||
self.draw_tab_directories()
|
||||
self.draw_tab_startstop()
|
||||
|
@ -138,7 +138,7 @@ class ServiceConfigDialog(Dialog):
|
|||
|
||||
def draw_tab_files(self) -> None:
|
||||
tab = ttk.Frame(self.notebook, padding=FRAME_PAD)
|
||||
tab.grid(sticky="nsew")
|
||||
tab.grid(sticky=tk.NSEW)
|
||||
tab.columnconfigure(0, weight=1)
|
||||
self.notebook.add(tab, text="Files")
|
||||
|
||||
|
@ -148,15 +148,15 @@ class ServiceConfigDialog(Dialog):
|
|||
label.grid()
|
||||
|
||||
frame = ttk.Frame(tab)
|
||||
frame.grid(sticky="ew", pady=PADY)
|
||||
frame.grid(sticky=tk.EW, pady=PADY)
|
||||
frame.columnconfigure(1, weight=1)
|
||||
label = ttk.Label(frame, text="File Name")
|
||||
label.grid(row=0, column=0, padx=PADX, sticky="w")
|
||||
label.grid(row=0, column=0, padx=PADX, sticky=tk.W)
|
||||
self.filename_combobox = ttk.Combobox(frame, values=self.filenames)
|
||||
self.filename_combobox.bind(
|
||||
"<<ComboboxSelected>>", self.display_service_file_data
|
||||
)
|
||||
self.filename_combobox.grid(row=0, column=1, sticky="ew", padx=PADX)
|
||||
self.filename_combobox.grid(row=0, column=1, sticky=tk.EW, padx=PADX)
|
||||
button = ttk.Button(
|
||||
frame, image=self.documentnew_img, command=self.add_filename
|
||||
)
|
||||
|
@ -167,7 +167,7 @@ class ServiceConfigDialog(Dialog):
|
|||
button.grid(row=0, column=3)
|
||||
|
||||
frame = ttk.Frame(tab)
|
||||
frame.grid(sticky="ew", pady=PADY)
|
||||
frame.grid(sticky=tk.EW, pady=PADY)
|
||||
frame.columnconfigure(1, weight=1)
|
||||
button = ttk.Radiobutton(
|
||||
frame,
|
||||
|
@ -176,16 +176,16 @@ class ServiceConfigDialog(Dialog):
|
|||
value=1,
|
||||
state=tk.DISABLED,
|
||||
)
|
||||
button.grid(row=0, column=0, sticky="w", padx=PADX)
|
||||
button.grid(row=0, column=0, sticky=tk.W, padx=PADX)
|
||||
entry = ttk.Entry(frame, state=tk.DISABLED)
|
||||
entry.grid(row=0, column=1, sticky="ew", padx=PADX)
|
||||
entry.grid(row=0, column=1, sticky=tk.EW, padx=PADX)
|
||||
image = Images.get(ImageEnum.FILEOPEN, 16)
|
||||
button = ttk.Button(frame, image=image)
|
||||
button.image = image
|
||||
button.grid(row=0, column=2)
|
||||
|
||||
frame = ttk.Frame(tab)
|
||||
frame.grid(sticky="ew", pady=PADY)
|
||||
frame.grid(sticky=tk.EW, pady=PADY)
|
||||
frame.columnconfigure(0, weight=1)
|
||||
button = ttk.Radiobutton(
|
||||
frame,
|
||||
|
@ -193,7 +193,7 @@ class ServiceConfigDialog(Dialog):
|
|||
text="Use text below for file contents",
|
||||
value=2,
|
||||
)
|
||||
button.grid(row=0, column=0, sticky="ew")
|
||||
button.grid(row=0, column=0, sticky=tk.EW)
|
||||
image = Images.get(ImageEnum.FILEOPEN, 16)
|
||||
button = ttk.Button(frame, image=image)
|
||||
button.image = image
|
||||
|
@ -204,7 +204,7 @@ class ServiceConfigDialog(Dialog):
|
|||
button.grid(row=0, column=2)
|
||||
|
||||
self.service_file_data = CodeText(tab)
|
||||
self.service_file_data.grid(sticky="nsew")
|
||||
self.service_file_data.grid(sticky=tk.NSEW)
|
||||
tab.rowconfigure(self.service_file_data.grid_info()["row"], weight=1)
|
||||
if len(self.filenames) > 0:
|
||||
self.filename_combobox.current(0)
|
||||
|
@ -218,7 +218,7 @@ class ServiceConfigDialog(Dialog):
|
|||
|
||||
def draw_tab_directories(self) -> None:
|
||||
tab = ttk.Frame(self.notebook, padding=FRAME_PAD)
|
||||
tab.grid(sticky="nsew")
|
||||
tab.grid(sticky=tk.NSEW)
|
||||
tab.columnconfigure(0, weight=1)
|
||||
tab.rowconfigure(2, weight=1)
|
||||
self.notebook.add(tab, text="Directories")
|
||||
|
@ -227,33 +227,33 @@ class ServiceConfigDialog(Dialog):
|
|||
tab,
|
||||
text="Directories required by this service that are unique for each node.",
|
||||
)
|
||||
label.grid(row=0, column=0, sticky="ew")
|
||||
label.grid(row=0, column=0, sticky=tk.EW)
|
||||
frame = ttk.Frame(tab, padding=FRAME_PAD)
|
||||
frame.columnconfigure(0, weight=1)
|
||||
frame.grid(row=1, column=0, sticky="nsew")
|
||||
frame.grid(row=1, column=0, sticky=tk.NSEW)
|
||||
var = tk.StringVar(value="")
|
||||
self.directory_entry = ttk.Entry(frame, textvariable=var)
|
||||
self.directory_entry.grid(row=0, column=0, sticky="ew", padx=PADX)
|
||||
self.directory_entry.grid(row=0, column=0, sticky=tk.EW, padx=PADX)
|
||||
button = ttk.Button(frame, text="...", command=self.find_directory_button)
|
||||
button.grid(row=0, column=1, sticky="ew")
|
||||
button.grid(row=0, column=1, sticky=tk.EW)
|
||||
self.dir_list = ListboxScroll(tab)
|
||||
self.dir_list.grid(row=2, column=0, sticky="nsew", pady=PADY)
|
||||
self.dir_list.grid(row=2, column=0, sticky=tk.NSEW, pady=PADY)
|
||||
self.dir_list.listbox.bind("<<ListboxSelect>>", self.directory_select)
|
||||
for d in self.temp_directories:
|
||||
self.dir_list.listbox.insert("end", d)
|
||||
|
||||
frame = ttk.Frame(tab)
|
||||
frame.grid(row=3, column=0, sticky="nsew")
|
||||
frame.grid(row=3, column=0, sticky=tk.NSEW)
|
||||
frame.columnconfigure(0, weight=1)
|
||||
frame.columnconfigure(1, weight=1)
|
||||
button = ttk.Button(frame, text="Add", command=self.add_directory)
|
||||
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="Remove", command=self.remove_directory)
|
||||
button.grid(row=0, column=1, sticky="ew")
|
||||
button.grid(row=0, column=1, sticky=tk.EW)
|
||||
|
||||
def draw_tab_startstop(self) -> None:
|
||||
tab = ttk.Frame(self.notebook, padding=FRAME_PAD)
|
||||
tab.grid(sticky="nsew")
|
||||
tab.grid(sticky=tk.NSEW)
|
||||
tab.columnconfigure(0, weight=1)
|
||||
for i in range(3):
|
||||
tab.rowconfigure(i, weight=1)
|
||||
|
@ -279,25 +279,25 @@ class ServiceConfigDialog(Dialog):
|
|||
commands = self.validation_commands
|
||||
label_frame.columnconfigure(0, weight=1)
|
||||
label_frame.rowconfigure(1, weight=1)
|
||||
label_frame.grid(row=i, column=0, sticky="nsew", pady=PADY)
|
||||
label_frame.grid(row=i, column=0, sticky=tk.NSEW, pady=PADY)
|
||||
|
||||
frame = ttk.Frame(label_frame)
|
||||
frame.grid(row=0, column=0, sticky="nsew", pady=PADY)
|
||||
frame.grid(row=0, column=0, sticky=tk.NSEW, pady=PADY)
|
||||
frame.columnconfigure(0, weight=1)
|
||||
entry = ttk.Entry(frame, textvariable=tk.StringVar())
|
||||
entry.grid(row=0, column=0, stick="ew", padx=PADX)
|
||||
button = ttk.Button(frame, image=self.documentnew_img)
|
||||
button.bind("<Button-1>", self.add_command)
|
||||
button.grid(row=0, column=1, sticky="ew", padx=PADX)
|
||||
button.grid(row=0, column=1, sticky=tk.EW, padx=PADX)
|
||||
button = ttk.Button(frame, image=self.editdelete_img)
|
||||
button.grid(row=0, column=2, sticky="ew")
|
||||
button.grid(row=0, column=2, sticky=tk.EW)
|
||||
button.bind("<Button-1>", self.delete_command)
|
||||
listbox_scroll = ListboxScroll(label_frame)
|
||||
listbox_scroll.listbox.bind("<<ListboxSelect>>", self.update_entry)
|
||||
for command in commands:
|
||||
listbox_scroll.listbox.insert("end", command)
|
||||
listbox_scroll.listbox.config(height=4)
|
||||
listbox_scroll.grid(row=1, column=0, sticky="nsew")
|
||||
listbox_scroll.grid(row=1, column=0, sticky=tk.NSEW)
|
||||
if i == 0:
|
||||
self.startup_commands_listbox = listbox_scroll.listbox
|
||||
elif i == 1:
|
||||
|
@ -307,23 +307,23 @@ class ServiceConfigDialog(Dialog):
|
|||
|
||||
def draw_tab_configuration(self) -> None:
|
||||
tab = ttk.Frame(self.notebook, padding=FRAME_PAD)
|
||||
tab.grid(sticky="nsew")
|
||||
tab.grid(sticky=tk.NSEW)
|
||||
tab.columnconfigure(0, weight=1)
|
||||
self.notebook.add(tab, text="Configuration", sticky="nsew")
|
||||
self.notebook.add(tab, text="Configuration", sticky=tk.NSEW)
|
||||
|
||||
frame = ttk.Frame(tab)
|
||||
frame.grid(sticky="ew", pady=PADY)
|
||||
frame.grid(sticky=tk.EW, pady=PADY)
|
||||
frame.columnconfigure(1, weight=1)
|
||||
|
||||
label = ttk.Label(frame, text="Validation Time")
|
||||
label.grid(row=0, column=0, sticky="w", padx=PADX)
|
||||
label.grid(row=0, column=0, sticky=tk.W, padx=PADX)
|
||||
self.validation_time_entry = ttk.Entry(frame)
|
||||
self.validation_time_entry.insert("end", self.validation_time)
|
||||
self.validation_time_entry.config(state=tk.DISABLED)
|
||||
self.validation_time_entry.grid(row=0, column=1, sticky="ew", pady=PADY)
|
||||
self.validation_time_entry.grid(row=0, column=1, sticky=tk.EW, pady=PADY)
|
||||
|
||||
label = ttk.Label(frame, text="Validation Mode")
|
||||
label.grid(row=1, column=0, sticky="w", padx=PADX)
|
||||
label.grid(row=1, column=0, sticky=tk.W, padx=PADX)
|
||||
if self.validation_mode == ServiceValidationMode.BLOCKING:
|
||||
mode = "BLOCKING"
|
||||
elif self.validation_mode == ServiceValidationMode.NON_BLOCKING:
|
||||
|
@ -335,48 +335,48 @@ class ServiceConfigDialog(Dialog):
|
|||
)
|
||||
self.validation_mode_entry.insert("end", mode)
|
||||
self.validation_mode_entry.config(state=tk.DISABLED)
|
||||
self.validation_mode_entry.grid(row=1, column=1, sticky="ew", pady=PADY)
|
||||
self.validation_mode_entry.grid(row=1, column=1, sticky=tk.EW, pady=PADY)
|
||||
|
||||
label = ttk.Label(frame, text="Validation Period")
|
||||
label.grid(row=2, column=0, sticky="w", padx=PADX)
|
||||
label.grid(row=2, column=0, sticky=tk.W, padx=PADX)
|
||||
self.validation_period_entry = ttk.Entry(
|
||||
frame, state=tk.DISABLED, textvariable=tk.StringVar()
|
||||
)
|
||||
self.validation_period_entry.grid(row=2, column=1, sticky="ew", pady=PADY)
|
||||
self.validation_period_entry.grid(row=2, column=1, sticky=tk.EW, pady=PADY)
|
||||
|
||||
label_frame = ttk.LabelFrame(tab, text="Executables", padding=FRAME_PAD)
|
||||
label_frame.grid(sticky="nsew", pady=PADY)
|
||||
label_frame.grid(sticky=tk.NSEW, pady=PADY)
|
||||
label_frame.columnconfigure(0, weight=1)
|
||||
label_frame.rowconfigure(0, weight=1)
|
||||
listbox_scroll = ListboxScroll(label_frame)
|
||||
listbox_scroll.grid(sticky="nsew")
|
||||
listbox_scroll.grid(sticky=tk.NSEW)
|
||||
tab.rowconfigure(listbox_scroll.grid_info()["row"], weight=1)
|
||||
for executable in self.executables:
|
||||
listbox_scroll.listbox.insert("end", executable)
|
||||
|
||||
label_frame = ttk.LabelFrame(tab, text="Dependencies", padding=FRAME_PAD)
|
||||
label_frame.grid(sticky="nsew", pady=PADY)
|
||||
label_frame.grid(sticky=tk.NSEW, pady=PADY)
|
||||
label_frame.columnconfigure(0, weight=1)
|
||||
label_frame.rowconfigure(0, weight=1)
|
||||
listbox_scroll = ListboxScroll(label_frame)
|
||||
listbox_scroll.grid(sticky="nsew")
|
||||
listbox_scroll.grid(sticky=tk.NSEW)
|
||||
tab.rowconfigure(listbox_scroll.grid_info()["row"], weight=1)
|
||||
for dependency in self.dependencies:
|
||||
listbox_scroll.listbox.insert("end", dependency)
|
||||
|
||||
def draw_buttons(self) -> None:
|
||||
frame = ttk.Frame(self.top)
|
||||
frame.grid(sticky="ew")
|
||||
frame.grid(sticky=tk.EW)
|
||||
for i in range(4):
|
||||
frame.columnconfigure(i, weight=1)
|
||||
button = ttk.Button(frame, text="Apply", command=self.click_apply)
|
||||
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="Defaults", command=self.click_defaults)
|
||||
button.grid(row=0, column=1, sticky="ew", padx=PADX)
|
||||
button.grid(row=0, column=1, sticky=tk.EW, padx=PADX)
|
||||
button = ttk.Button(frame, text="Copy...", command=self.click_copy)
|
||||
button.grid(row=0, column=2, sticky="ew", padx=PADX)
|
||||
button.grid(row=0, column=2, sticky=tk.EW, padx=PADX)
|
||||
button = ttk.Button(frame, text="Cancel", command=self.destroy)
|
||||
button.grid(row=0, column=3, sticky="ew")
|
||||
button.grid(row=0, column=3, sticky=tk.EW)
|
||||
|
||||
def add_filename(self) -> None:
|
||||
filename = self.filename_combobox.get()
|
||||
|
|
|
@ -39,17 +39,17 @@ class SessionOptionsDialog(Dialog):
|
|||
self.top.rowconfigure(0, weight=1)
|
||||
self.config_frame = ConfigFrame(self.top, self.app, self.config, self.enabled)
|
||||
self.config_frame.draw_config()
|
||||
self.config_frame.grid(sticky="nsew", pady=PADY)
|
||||
self.config_frame.grid(sticky=tk.NSEW, pady=PADY)
|
||||
|
||||
frame = ttk.Frame(self.top)
|
||||
frame.grid(sticky="ew")
|
||||
frame.grid(sticky=tk.EW)
|
||||
for i in range(2):
|
||||
frame.columnconfigure(i, weight=1)
|
||||
state = tk.NORMAL if self.enabled else tk.DISABLED
|
||||
button = ttk.Button(frame, text="Save", command=self.save, state=state)
|
||||
button.grid(row=0, column=0, padx=PADX, sticky="ew")
|
||||
button.grid(row=0, column=0, padx=PADX, sticky=tk.EW)
|
||||
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 save(self) -> None:
|
||||
config = self.config_frame.parse_config()
|
||||
|
|
|
@ -62,7 +62,7 @@ class SessionsDialog(Dialog):
|
|||
frame = ttk.Frame(self.top)
|
||||
frame.columnconfigure(0, weight=1)
|
||||
frame.rowconfigure(0, weight=1)
|
||||
frame.grid(sticky="nsew", pady=PADY)
|
||||
frame.grid(sticky=tk.NSEW, pady=PADY)
|
||||
self.tree = ttk.Treeview(
|
||||
frame,
|
||||
columns=("id", "state", "nodes"),
|
||||
|
@ -72,7 +72,7 @@ class SessionsDialog(Dialog):
|
|||
style = ttk.Style()
|
||||
heading_size = int(self.app.guiconfig.scale * 10)
|
||||
style.configure("Treeview.Heading", font=(None, heading_size, "bold"))
|
||||
self.tree.grid(sticky="nsew")
|
||||
self.tree.grid(sticky=tk.NSEW)
|
||||
self.tree.column("id", stretch=tk.YES, anchor="center")
|
||||
self.tree.heading("id", text="ID")
|
||||
self.tree.column("state", stretch=tk.YES, anchor="center")
|
||||
|
@ -92,25 +92,25 @@ class SessionsDialog(Dialog):
|
|||
self.tree.bind("<<TreeviewSelect>>", self.click_select)
|
||||
|
||||
yscrollbar = ttk.Scrollbar(frame, orient="vertical", command=self.tree.yview)
|
||||
yscrollbar.grid(row=0, column=1, sticky="ns")
|
||||
yscrollbar.grid(row=0, column=1, sticky=tk.NS)
|
||||
self.tree.configure(yscrollcommand=yscrollbar.set)
|
||||
|
||||
xscrollbar = ttk.Scrollbar(frame, orient="horizontal", command=self.tree.xview)
|
||||
xscrollbar.grid(row=1, sticky="ew")
|
||||
xscrollbar.grid(row=1, sticky=tk.EW)
|
||||
self.tree.configure(xscrollcommand=xscrollbar.set)
|
||||
|
||||
def draw_buttons(self) -> None:
|
||||
frame = ttk.Frame(self.top)
|
||||
for i in range(4):
|
||||
frame.columnconfigure(i, weight=1)
|
||||
frame.grid(sticky="ew")
|
||||
frame.grid(sticky=tk.EW)
|
||||
|
||||
image = Images.get(ImageEnum.DOCUMENTNEW, 16)
|
||||
b = ttk.Button(
|
||||
frame, image=image, text="New", compound=tk.LEFT, command=self.click_new
|
||||
)
|
||||
b.image = image
|
||||
b.grid(row=0, padx=PADX, sticky="ew")
|
||||
b.grid(row=0, padx=PADX, sticky=tk.EW)
|
||||
|
||||
image = Images.get(ImageEnum.FILEOPEN, 16)
|
||||
self.connect_button = ttk.Button(
|
||||
|
@ -122,7 +122,7 @@ class SessionsDialog(Dialog):
|
|||
state=tk.DISABLED,
|
||||
)
|
||||
self.connect_button.image = image
|
||||
self.connect_button.grid(row=0, column=1, padx=PADX, sticky="ew")
|
||||
self.connect_button.grid(row=0, column=1, padx=PADX, sticky=tk.EW)
|
||||
|
||||
image = Images.get(ImageEnum.DELETE, 16)
|
||||
self.delete_button = ttk.Button(
|
||||
|
@ -134,7 +134,7 @@ class SessionsDialog(Dialog):
|
|||
state=tk.DISABLED,
|
||||
)
|
||||
self.delete_button.image = image
|
||||
self.delete_button.grid(row=0, column=2, padx=PADX, sticky="ew")
|
||||
self.delete_button.grid(row=0, column=2, padx=PADX, sticky=tk.EW)
|
||||
|
||||
image = Images.get(ImageEnum.CANCEL, 16)
|
||||
if self.is_start_app:
|
||||
|
@ -154,7 +154,7 @@ class SessionsDialog(Dialog):
|
|||
command=self.destroy,
|
||||
)
|
||||
b.image = image
|
||||
b.grid(row=0, column=3, sticky="ew")
|
||||
b.grid(row=0, column=3, sticky=tk.EW)
|
||||
|
||||
def click_new(self) -> None:
|
||||
self.app.core.create_new_session()
|
||||
|
|
|
@ -57,15 +57,15 @@ class ShapeDialog(Dialog):
|
|||
|
||||
def draw_label_options(self) -> None:
|
||||
label_frame = ttk.LabelFrame(self.top, text="Label", padding=FRAME_PAD)
|
||||
label_frame.grid(sticky="ew")
|
||||
label_frame.grid(sticky=tk.EW)
|
||||
label_frame.columnconfigure(0, weight=1)
|
||||
|
||||
entry = ttk.Entry(label_frame, textvariable=self.shape_text)
|
||||
entry.grid(sticky="ew", pady=PADY)
|
||||
entry.grid(sticky=tk.EW, pady=PADY)
|
||||
|
||||
# font options
|
||||
frame = ttk.Frame(label_frame)
|
||||
frame.grid(sticky="nsew", pady=PADY)
|
||||
frame.grid(sticky=tk.NSEW, pady=PADY)
|
||||
frame.columnconfigure(0, weight=1)
|
||||
frame.columnconfigure(1, weight=1)
|
||||
frame.columnconfigure(2, weight=1)
|
||||
|
@ -75,70 +75,70 @@ class ShapeDialog(Dialog):
|
|||
values=sorted(font.families()),
|
||||
state="readonly",
|
||||
)
|
||||
combobox.grid(row=0, column=0, sticky="nsew")
|
||||
combobox.grid(row=0, column=0, sticky=tk.NSEW)
|
||||
combobox = ttk.Combobox(
|
||||
frame, textvariable=self.font_size, values=FONT_SIZES, state="readonly"
|
||||
)
|
||||
combobox.grid(row=0, column=1, padx=PADX, sticky="nsew")
|
||||
combobox.grid(row=0, column=1, padx=PADX, sticky=tk.NSEW)
|
||||
button = ttk.Button(frame, text="Color", command=self.choose_text_color)
|
||||
button.grid(row=0, column=2, sticky="nsew")
|
||||
button.grid(row=0, column=2, sticky=tk.NSEW)
|
||||
|
||||
# style options
|
||||
frame = ttk.Frame(label_frame)
|
||||
frame.grid(sticky="ew")
|
||||
frame.grid(sticky=tk.EW)
|
||||
for i in range(3):
|
||||
frame.columnconfigure(i, weight=1)
|
||||
button = ttk.Checkbutton(frame, variable=self.bold, text="Bold")
|
||||
button.grid(row=0, column=0, sticky="ew")
|
||||
button.grid(row=0, column=0, sticky=tk.EW)
|
||||
button = ttk.Checkbutton(frame, variable=self.italic, text="Italic")
|
||||
button.grid(row=0, column=1, padx=PADX, sticky="ew")
|
||||
button.grid(row=0, column=1, padx=PADX, sticky=tk.EW)
|
||||
button = ttk.Checkbutton(frame, variable=self.underline, text="Underline")
|
||||
button.grid(row=0, column=2, sticky="ew")
|
||||
button.grid(row=0, column=2, sticky=tk.EW)
|
||||
|
||||
def draw_shape_options(self) -> None:
|
||||
label_frame = ttk.LabelFrame(self.top, text="Shape", padding=FRAME_PAD)
|
||||
label_frame.grid(sticky="ew", pady=PADY)
|
||||
label_frame.grid(sticky=tk.EW, pady=PADY)
|
||||
label_frame.columnconfigure(0, weight=1)
|
||||
|
||||
frame = ttk.Frame(label_frame)
|
||||
frame.grid(sticky="ew")
|
||||
frame.grid(sticky=tk.EW)
|
||||
for i in range(1, 3):
|
||||
frame.columnconfigure(i, weight=1)
|
||||
label = ttk.Label(frame, text="Fill Color")
|
||||
label.grid(row=0, column=0, padx=PADX, sticky="w")
|
||||
label.grid(row=0, column=0, padx=PADX, sticky=tk.W)
|
||||
self.fill = ttk.Label(frame, text=self.fill_color, background=self.fill_color)
|
||||
self.fill.grid(row=0, column=1, sticky="ew", padx=PADX)
|
||||
self.fill.grid(row=0, column=1, sticky=tk.EW, padx=PADX)
|
||||
button = ttk.Button(frame, text="Color", command=self.choose_fill_color)
|
||||
button.grid(row=0, column=2, sticky="ew")
|
||||
button.grid(row=0, column=2, sticky=tk.EW)
|
||||
|
||||
label = ttk.Label(frame, text="Border Color")
|
||||
label.grid(row=1, column=0, sticky="w", padx=PADX)
|
||||
label.grid(row=1, column=0, sticky=tk.W, padx=PADX)
|
||||
self.border = ttk.Label(
|
||||
frame, text=self.border_color, background=self.border_color
|
||||
)
|
||||
self.border.grid(row=1, column=1, sticky="ew", padx=PADX)
|
||||
self.border.grid(row=1, column=1, sticky=tk.EW, padx=PADX)
|
||||
button = ttk.Button(frame, text="Color", command=self.choose_border_color)
|
||||
button.grid(row=1, column=2, sticky="ew")
|
||||
button.grid(row=1, column=2, sticky=tk.EW)
|
||||
|
||||
frame = ttk.Frame(label_frame)
|
||||
frame.grid(sticky="ew", pady=PADY)
|
||||
frame.grid(sticky=tk.EW, pady=PADY)
|
||||
frame.columnconfigure(1, weight=1)
|
||||
label = ttk.Label(frame, text="Border Width")
|
||||
label.grid(row=0, column=0, sticky="w", padx=PADX)
|
||||
label.grid(row=0, column=0, sticky=tk.W, padx=PADX)
|
||||
combobox = ttk.Combobox(
|
||||
frame, textvariable=self.border_width, values=BORDER_WIDTH, state="readonly"
|
||||
)
|
||||
combobox.grid(row=0, column=1, sticky="nsew")
|
||||
combobox.grid(row=0, column=1, sticky=tk.NSEW)
|
||||
|
||||
def draw_buttons(self) -> None:
|
||||
frame = ttk.Frame(self.top)
|
||||
frame.grid(sticky="nsew")
|
||||
frame.grid(sticky=tk.NSEW)
|
||||
frame.columnconfigure(0, weight=1)
|
||||
frame.columnconfigure(1, weight=1)
|
||||
button = ttk.Button(frame, text="Add shape", command=self.click_add)
|
||||
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.cancel)
|
||||
button.grid(row=0, column=1, sticky="ew")
|
||||
button.grid(row=0, column=1, sticky=tk.EW)
|
||||
|
||||
def choose_text_color(self) -> None:
|
||||
color_picker = ColorPickerDialog(self, self.app, self.text_color)
|
||||
|
|
|
@ -37,25 +37,25 @@ class ThroughputDialog(Dialog):
|
|||
variable=self.show_throughput,
|
||||
text="Show Throughput Level On Every Link",
|
||||
)
|
||||
button.grid(sticky="ew")
|
||||
button.grid(sticky=tk.EW)
|
||||
button = ttk.Checkbutton(
|
||||
self.top,
|
||||
variable=self.exponential_weight,
|
||||
text="Use Exponential Weighted Moving Average",
|
||||
)
|
||||
button.grid(sticky="ew")
|
||||
button.grid(sticky=tk.EW)
|
||||
button = ttk.Checkbutton(
|
||||
self.top, variable=self.transmission, text="Include Transmissions"
|
||||
)
|
||||
button.grid(sticky="ew")
|
||||
button.grid(sticky=tk.EW)
|
||||
button = ttk.Checkbutton(
|
||||
self.top, variable=self.reception, text="Include Receptions"
|
||||
)
|
||||
button.grid(sticky="ew")
|
||||
button.grid(sticky=tk.EW)
|
||||
|
||||
label_frame = ttk.LabelFrame(self.top, text="Link Highlight", padding=FRAME_PAD)
|
||||
label_frame.columnconfigure(0, weight=1)
|
||||
label_frame.grid(sticky="ew")
|
||||
label_frame.grid(sticky=tk.EW)
|
||||
|
||||
scale = ttk.Scale(
|
||||
label_frame,
|
||||
|
@ -65,21 +65,21 @@ class ThroughputDialog(Dialog):
|
|||
orient=tk.HORIZONTAL,
|
||||
variable=self.threshold,
|
||||
)
|
||||
scale.grid(sticky="ew", pady=PADY)
|
||||
scale.grid(sticky=tk.EW, pady=PADY)
|
||||
|
||||
frame = ttk.Frame(label_frame)
|
||||
frame.grid(sticky="ew")
|
||||
frame.grid(sticky=tk.EW)
|
||||
frame.columnconfigure(1, weight=1)
|
||||
label = ttk.Label(frame, text="Threshold Kbps (0 disabled)")
|
||||
label.grid(row=0, column=0, sticky="ew", padx=PADX)
|
||||
label.grid(row=0, column=0, sticky=tk.EW, padx=PADX)
|
||||
entry = ttk.Entry(frame, textvariable=self.threshold)
|
||||
entry.grid(row=0, column=1, sticky="ew", pady=PADY)
|
||||
entry.grid(row=0, column=1, sticky=tk.EW, pady=PADY)
|
||||
label = ttk.Label(frame, text="Width")
|
||||
label.grid(row=1, column=0, sticky="ew", padx=PADX)
|
||||
label.grid(row=1, column=0, sticky=tk.EW, padx=PADX)
|
||||
entry = ttk.Entry(frame, textvariable=self.width)
|
||||
entry.grid(row=1, column=1, sticky="ew", pady=PADY)
|
||||
entry.grid(row=1, column=1, sticky=tk.EW, pady=PADY)
|
||||
label = ttk.Label(frame, text="Color")
|
||||
label.grid(row=2, column=0, sticky="ew", padx=PADX)
|
||||
label.grid(row=2, column=0, sticky=tk.EW, padx=PADX)
|
||||
self.color_button = tk.Button(
|
||||
frame,
|
||||
text=self.color,
|
||||
|
@ -87,18 +87,18 @@ class ThroughputDialog(Dialog):
|
|||
bg=self.color,
|
||||
highlightthickness=0,
|
||||
)
|
||||
self.color_button.grid(row=2, column=1, sticky="ew")
|
||||
self.color_button.grid(row=2, column=1, sticky=tk.EW)
|
||||
|
||||
self.draw_spacer()
|
||||
|
||||
frame = ttk.Frame(self.top)
|
||||
frame.grid(sticky="ew")
|
||||
frame.grid(sticky=tk.EW)
|
||||
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_color(self) -> None:
|
||||
color_picker = ColorPickerDialog(self, self.app, self.color)
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import tkinter as tk
|
||||
from tkinter import ttk
|
||||
from typing import TYPE_CHECKING, Dict, Optional
|
||||
|
||||
|
@ -54,7 +55,7 @@ class WlanConfigDialog(Dialog):
|
|||
self.top.rowconfigure(0, weight=1)
|
||||
self.config_frame = ConfigFrame(self.top, self.app, self.config)
|
||||
self.config_frame.draw_config()
|
||||
self.config_frame.grid(sticky="nsew", pady=PADY)
|
||||
self.config_frame.grid(sticky=tk.NSEW, pady=PADY)
|
||||
self.draw_apply_buttons()
|
||||
self.top.bind("<Destroy>", self.remove_ranges)
|
||||
|
||||
|
@ -63,7 +64,7 @@ class WlanConfigDialog(Dialog):
|
|||
create node configuration options
|
||||
"""
|
||||
frame = ttk.Frame(self.top)
|
||||
frame.grid(sticky="ew")
|
||||
frame.grid(sticky=tk.EW)
|
||||
for i in range(2):
|
||||
frame.columnconfigure(i, weight=1)
|
||||
|
||||
|
@ -73,10 +74,10 @@ class WlanConfigDialog(Dialog):
|
|||
self.range_entry.config(validatecommand=(self.positive_int, "%P"))
|
||||
|
||||
button = ttk.Button(frame, text="Apply", command=self.click_apply)
|
||||
button.grid(row=0, column=0, padx=PADX, sticky="ew")
|
||||
button.grid(row=0, column=0, padx=PADX, sticky=tk.EW)
|
||||
|
||||
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_apply(self) -> None:
|
||||
"""
|
||||
|
|
|
@ -38,7 +38,7 @@ class EdgeInfoFrame(InfoFrameBase):
|
|||
dst_node = self.app.core.session.nodes[link.node2_id]
|
||||
|
||||
frame = DetailsFrame(self)
|
||||
frame.grid(sticky="ew")
|
||||
frame.grid(sticky=tk.EW)
|
||||
frame.add_detail("Source", src_node.name)
|
||||
iface1 = link.iface1
|
||||
if iface1:
|
||||
|
@ -90,7 +90,7 @@ class WirelessEdgeInfoFrame(InfoFrameBase):
|
|||
iface2 = get_iface(dst_canvas_node, net_id)
|
||||
|
||||
frame = DetailsFrame(self)
|
||||
frame.grid(sticky="ew")
|
||||
frame.grid(sticky=tk.EW)
|
||||
frame.add_detail("Source", src_node.name)
|
||||
if iface1:
|
||||
mac = iface1.mac if iface1.mac else "auto"
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import tkinter as tk
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from core.gui.frames.base import DetailsFrame, InfoFrameBase
|
||||
|
@ -18,7 +19,7 @@ class NodeInfoFrame(InfoFrameBase):
|
|||
self.columnconfigure(0, weight=1)
|
||||
node = self.canvas_node.core_node
|
||||
frame = DetailsFrame(self)
|
||||
frame.grid(sticky="ew")
|
||||
frame.grid(sticky=tk.EW)
|
||||
frame.add_detail("ID", node.id)
|
||||
frame.add_detail("Name", node.name)
|
||||
if NodeUtils.is_model_node(node.type):
|
||||
|
|
|
@ -34,7 +34,7 @@ class StatusBar(ttk.Frame):
|
|||
self.columnconfigure(3, weight=1)
|
||||
|
||||
frame = ttk.Frame(self, borderwidth=1, relief=tk.RIDGE)
|
||||
frame.grid(row=0, column=0, sticky="ew")
|
||||
frame.grid(row=0, column=0, sticky=tk.EW)
|
||||
frame.columnconfigure(0, weight=1)
|
||||
|
||||
self.status = ttk.Label(
|
||||
|
@ -44,22 +44,22 @@ class StatusBar(ttk.Frame):
|
|||
borderwidth=1,
|
||||
relief=tk.RIDGE,
|
||||
)
|
||||
self.status.grid(row=0, column=0, sticky="ew")
|
||||
self.status.grid(row=0, column=0, sticky=tk.EW)
|
||||
|
||||
self.zoom = ttk.Label(self, anchor=tk.CENTER, borderwidth=1, relief=tk.RIDGE)
|
||||
self.zoom.grid(row=0, column=1, sticky="ew")
|
||||
self.zoom.grid(row=0, column=1, sticky=tk.EW)
|
||||
self.set_zoom(self.app.canvas.ratio)
|
||||
|
||||
self.cpu_label = ttk.Label(
|
||||
self, anchor=tk.CENTER, borderwidth=1, relief=tk.RIDGE
|
||||
)
|
||||
self.cpu_label.grid(row=0, column=2, sticky="ew")
|
||||
self.cpu_label.grid(row=0, column=2, sticky=tk.EW)
|
||||
self.set_cpu(0.0)
|
||||
|
||||
self.alerts_button = ttk.Button(
|
||||
self, text="Alerts", command=self.click_alerts, style=self.alert_style
|
||||
)
|
||||
self.alerts_button.grid(row=0, column=3, sticky="ew")
|
||||
self.alerts_button.grid(row=0, column=3, sticky=tk.EW)
|
||||
|
||||
def set_cpu(self, usage: float) -> None:
|
||||
self.cpu_label.config(text=f"CPU {usage * 100:.2f}%")
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import logging
|
||||
import threading
|
||||
import time
|
||||
import tkinter as tk
|
||||
from typing import TYPE_CHECKING, Any, Callable, Optional, Tuple
|
||||
|
||||
if TYPE_CHECKING:
|
||||
|
@ -26,7 +27,7 @@ class ProgressTask:
|
|||
self.time: Optional[float] = None
|
||||
|
||||
def start(self) -> None:
|
||||
self.app.progress.grid(sticky="ew", columnspan=2)
|
||||
self.app.progress.grid(sticky=tk.EW, columnspan=2)
|
||||
self.app.progress.start()
|
||||
self.time = time.perf_counter()
|
||||
thread = threading.Thread(target=self.run, daemon=True)
|
||||
|
|
|
@ -95,7 +95,7 @@ class ButtonBar(ttk.Frame):
|
|||
image = self.app.get_icon(image_enum, TOOLBAR_SIZE)
|
||||
button = ttk.Button(self, image=image, command=func)
|
||||
button.image = image
|
||||
button.grid(sticky="ew")
|
||||
button.grid(sticky=tk.EW)
|
||||
Tooltip(button, tooltip)
|
||||
if radio:
|
||||
self.radio_buttons.append(button)
|
||||
|
@ -124,7 +124,7 @@ class MarkerFrame(ttk.Frame):
|
|||
image = self.app.get_icon(ImageEnum.DELETE, 16)
|
||||
button = ttk.Button(self, image=image, width=2, command=self.click_clear)
|
||||
button.image = image
|
||||
button.grid(sticky="ew", pady=self.PAD)
|
||||
button.grid(sticky=tk.EW, pady=self.PAD)
|
||||
Tooltip(button, "Delete Marker")
|
||||
|
||||
sizes = [1, 3, 8, 10]
|
||||
|
@ -132,14 +132,14 @@ class MarkerFrame(ttk.Frame):
|
|||
sizes = ttk.Combobox(
|
||||
self, state="readonly", textvariable=self.size, value=sizes, width=2
|
||||
)
|
||||
sizes.grid(sticky="ew", pady=self.PAD)
|
||||
sizes.grid(sticky=tk.EW, pady=self.PAD)
|
||||
Tooltip(sizes, "Marker Size")
|
||||
|
||||
frame_size = TOOLBAR_SIZE
|
||||
self.color_frame = tk.Frame(
|
||||
self, background=self.color, height=frame_size, width=frame_size
|
||||
)
|
||||
self.color_frame.grid(sticky="ew")
|
||||
self.color_frame.grid(sticky=tk.EW)
|
||||
self.color_frame.bind("<Button-1>", self.click_color)
|
||||
Tooltip(self.color_frame, "Marker Color")
|
||||
|
||||
|
@ -207,7 +207,7 @@ class Toolbar(ttk.Frame):
|
|||
|
||||
def draw_design_frame(self) -> None:
|
||||
self.design_frame = ButtonBar(self, self.app)
|
||||
self.design_frame.grid(row=0, column=0, sticky="nsew")
|
||||
self.design_frame.grid(row=0, column=0, sticky=tk.NSEW)
|
||||
self.design_frame.columnconfigure(0, weight=1)
|
||||
self.play_button = self.design_frame.create_button(
|
||||
ImageEnum.START, self.click_start, "Start Session"
|
||||
|
@ -239,7 +239,7 @@ class Toolbar(ttk.Frame):
|
|||
|
||||
def draw_runtime_frame(self) -> None:
|
||||
self.runtime_frame = ButtonBar(self, self.app)
|
||||
self.runtime_frame.grid(row=0, column=0, sticky="nsew")
|
||||
self.runtime_frame.grid(row=0, column=0, sticky=tk.NSEW)
|
||||
self.runtime_frame.columnconfigure(0, weight=1)
|
||||
self.stop_button = self.runtime_frame.create_button(
|
||||
ImageEnum.STOP, self.click_stop, "Stop Session"
|
||||
|
@ -387,7 +387,7 @@ class Toolbar(ttk.Frame):
|
|||
self.runtime_frame, image=image, direction=tk.RIGHT
|
||||
)
|
||||
menu_button.image = image
|
||||
menu_button.grid(sticky="ew")
|
||||
menu_button.grid(sticky=tk.EW)
|
||||
self.observers_menu = ObserversMenu(menu_button, self.app)
|
||||
menu_button["menu"] = self.observers_menu
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ class Tooltip(object):
|
|||
self.tw.rowconfigure(0, weight=1)
|
||||
self.tw.columnconfigure(0, weight=1)
|
||||
frame = ttk.Frame(self.tw, style=Styles.tooltip_frame, padding=3)
|
||||
frame.grid(sticky="nsew")
|
||||
frame.grid(sticky=tk.NSEW)
|
||||
label = ttk.Label(frame, text=self.text, style=Styles.tooltip)
|
||||
label.grid()
|
||||
|
||||
|
|
|
@ -47,13 +47,13 @@ class FrameScroll(ttk.Frame):
|
|||
self.columnconfigure(0, weight=1)
|
||||
bg = self.app.style.lookup(".", "background")
|
||||
self.canvas: tk.Canvas = tk.Canvas(self, highlightthickness=0, background=bg)
|
||||
self.canvas.grid(row=0, sticky="nsew", padx=2, pady=2)
|
||||
self.canvas.grid(row=0, sticky=tk.NSEW, padx=2, pady=2)
|
||||
self.canvas.columnconfigure(0, weight=1)
|
||||
self.canvas.rowconfigure(0, weight=1)
|
||||
self.scrollbar: ttk.Scrollbar = ttk.Scrollbar(
|
||||
self, orient="vertical", command=self.canvas.yview
|
||||
)
|
||||
self.scrollbar.grid(row=0, column=1, sticky="ns")
|
||||
self.scrollbar.grid(row=0, column=1, sticky=tk.NS)
|
||||
self.frame: ttk.Frame = _cls(self.canvas)
|
||||
self.frame_id: int = self.canvas.create_window(
|
||||
0, 0, anchor="nw", window=self.frame
|
||||
|
@ -108,7 +108,7 @@ class ConfigFrame(ttk.Notebook):
|
|||
self.add(tab, text=group_name)
|
||||
for index, option in enumerate(sorted(group, key=lambda x: x.name)):
|
||||
label = ttk.Label(tab.frame, text=option.label)
|
||||
label.grid(row=index, pady=PADY, padx=PADX, sticky="w")
|
||||
label.grid(row=index, pady=PADY, padx=PADX, sticky=tk.W)
|
||||
value = tk.StringVar()
|
||||
if option.type == ConfigOptionType.BOOL:
|
||||
select = ("On", "Off")
|
||||
|
@ -116,7 +116,7 @@ class ConfigFrame(ttk.Notebook):
|
|||
combobox = ttk.Combobox(
|
||||
tab.frame, textvariable=value, values=select, state=state
|
||||
)
|
||||
combobox.grid(row=index, column=1, sticky="ew")
|
||||
combobox.grid(row=index, column=1, sticky=tk.EW)
|
||||
if option.value == "1":
|
||||
value.set("On")
|
||||
else:
|
||||
|
@ -128,16 +128,16 @@ class ConfigFrame(ttk.Notebook):
|
|||
combobox = ttk.Combobox(
|
||||
tab.frame, textvariable=value, values=select, state=state
|
||||
)
|
||||
combobox.grid(row=index, column=1, sticky="ew")
|
||||
combobox.grid(row=index, column=1, sticky=tk.EW)
|
||||
elif option.type == ConfigOptionType.STRING:
|
||||
value.set(option.value)
|
||||
state = tk.NORMAL if self.enabled else tk.DISABLED
|
||||
if "file" in option.label:
|
||||
file_frame = ttk.Frame(tab.frame)
|
||||
file_frame.grid(row=index, column=1, sticky="ew")
|
||||
file_frame.grid(row=index, column=1, sticky=tk.EW)
|
||||
file_frame.columnconfigure(0, weight=1)
|
||||
entry = ttk.Entry(file_frame, textvariable=value, state=state)
|
||||
entry.grid(row=0, column=0, sticky="ew", padx=PADX)
|
||||
entry.grid(row=0, column=0, sticky=tk.EW, padx=PADX)
|
||||
func = partial(file_button_click, value, self)
|
||||
button = ttk.Button(
|
||||
file_frame, text="...", command=func, state=state
|
||||
|
@ -145,21 +145,21 @@ class ConfigFrame(ttk.Notebook):
|
|||
button.grid(row=0, column=1)
|
||||
else:
|
||||
entry = ttk.Entry(tab.frame, textvariable=value, state=state)
|
||||
entry.grid(row=index, column=1, sticky="ew")
|
||||
entry.grid(row=index, column=1, sticky=tk.EW)
|
||||
elif option.type in INT_TYPES:
|
||||
value.set(option.value)
|
||||
state = tk.NORMAL if self.enabled else tk.DISABLED
|
||||
entry = validation.PositiveIntEntry(
|
||||
tab.frame, textvariable=value, state=state
|
||||
)
|
||||
entry.grid(row=index, column=1, sticky="ew")
|
||||
entry.grid(row=index, column=1, sticky=tk.EW)
|
||||
elif option.type == ConfigOptionType.FLOAT:
|
||||
value.set(option.value)
|
||||
state = tk.NORMAL if self.enabled else tk.DISABLED
|
||||
entry = validation.PositiveFloatEntry(
|
||||
tab.frame, textvariable=value, state=state
|
||||
)
|
||||
entry.grid(row=index, column=1, sticky="ew")
|
||||
entry.grid(row=index, column=1, sticky=tk.EW)
|
||||
else:
|
||||
logging.error("unhandled config option type: %s", option.type)
|
||||
self.values[option.name] = value
|
||||
|
@ -196,7 +196,7 @@ class ListboxScroll(ttk.Frame):
|
|||
self.columnconfigure(0, weight=1)
|
||||
self.rowconfigure(0, weight=1)
|
||||
self.scrollbar: ttk.Scrollbar = ttk.Scrollbar(self, orient=tk.VERTICAL)
|
||||
self.scrollbar.grid(row=0, column=1, sticky="ns")
|
||||
self.scrollbar.grid(row=0, column=1, sticky=tk.NS)
|
||||
self.listbox: tk.Listbox = tk.Listbox(
|
||||
self,
|
||||
selectmode=tk.BROWSE,
|
||||
|
@ -204,7 +204,7 @@ class ListboxScroll(ttk.Frame):
|
|||
exportselection=False,
|
||||
)
|
||||
themes.style_listbox(self.listbox)
|
||||
self.listbox.grid(row=0, column=0, sticky="nsew")
|
||||
self.listbox.grid(row=0, column=0, sticky=tk.NSEW)
|
||||
self.scrollbar.config(command=self.listbox.yview)
|
||||
|
||||
|
||||
|
@ -224,7 +224,7 @@ class CheckboxList(FrameScroll):
|
|||
var = tk.BooleanVar(value=checked)
|
||||
func = partial(self.clicked, name, var)
|
||||
checkbox = ttk.Checkbutton(self.frame, text=name, variable=var, command=func)
|
||||
checkbox.grid(sticky="w")
|
||||
checkbox.grid(sticky=tk.W)
|
||||
|
||||
|
||||
class CodeFont(font.Font):
|
||||
|
@ -250,9 +250,9 @@ class CodeText(ttk.Frame):
|
|||
selectforeground="black",
|
||||
relief=tk.FLAT,
|
||||
)
|
||||
self.text.grid(row=0, column=0, sticky="nsew")
|
||||
self.text.grid(row=0, column=0, sticky=tk.NSEW)
|
||||
yscrollbar = ttk.Scrollbar(self, orient=tk.VERTICAL, command=self.text.yview)
|
||||
yscrollbar.grid(row=0, column=1, sticky="ns")
|
||||
yscrollbar.grid(row=0, column=1, sticky=tk.NS)
|
||||
self.text.configure(yscrollcommand=yscrollbar.set)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue