finished converting dialogs to use ttk
This commit is contained in:
parent
58a4db6050
commit
469e32b890
4 changed files with 87 additions and 96 deletions
coretk/coretk/dialogs
|
@ -2,11 +2,10 @@
|
||||||
mobility configuration
|
mobility configuration
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
|
||||||
import tkinter as tk
|
import tkinter as tk
|
||||||
from pathlib import Path
|
from tkinter import filedialog, ttk
|
||||||
from tkinter import filedialog
|
|
||||||
|
|
||||||
|
from coretk import appconfig
|
||||||
from coretk.dialogs.dialog import Dialog
|
from coretk.dialogs.dialog import Dialog
|
||||||
|
|
||||||
|
|
||||||
|
@ -40,12 +39,12 @@ class MobilityConfiguration(Dialog):
|
||||||
return var
|
return var
|
||||||
|
|
||||||
def open_file(self, entry):
|
def open_file(self, entry):
|
||||||
configs_dir = os.path.join(Path.home(), ".core/configs")
|
filename = filedialog.askopenfilename(
|
||||||
if os.path.isdir(configs_dir):
|
initialdir=str(appconfig.MOBILITY_PATH), title="Open"
|
||||||
filename = filedialog.askopenfilename(initialdir=configs_dir, title="Open")
|
)
|
||||||
if filename:
|
if filename:
|
||||||
entry.delete(0, tk.END)
|
entry.delete(0, tk.END)
|
||||||
entry.insert(0, filename)
|
entry.insert(0, filename)
|
||||||
|
|
||||||
def set_loop_value(self, value):
|
def set_loop_value(self, value):
|
||||||
"""
|
"""
|
||||||
|
@ -58,26 +57,26 @@ class MobilityConfiguration(Dialog):
|
||||||
def create_label_entry_filebrowser(
|
def create_label_entry_filebrowser(
|
||||||
self, parent_frame, text_label, entry_text, filebrowser=False
|
self, parent_frame, text_label, entry_text, filebrowser=False
|
||||||
):
|
):
|
||||||
f = tk.Frame(parent_frame, bg="#d9d9d9")
|
f = ttk.Frame(parent_frame, bg="#d9d9d9")
|
||||||
lbl = tk.Label(f, text=text_label, bg="#d9d9d9")
|
lbl = ttk.Label(f, text=text_label, bg="#d9d9d9")
|
||||||
lbl.grid(padx=3, pady=3)
|
lbl.grid(padx=3, pady=3)
|
||||||
# f.grid()
|
# f.grid()
|
||||||
e = tk.Entry(f, textvariable=self.create_string_var(entry_text), bg="#ffffff")
|
e = ttk.Entry(f, textvariable=self.create_string_var(entry_text), bg="#ffffff")
|
||||||
e.grid(row=0, column=1, padx=3, pady=3)
|
e.grid(row=0, column=1, padx=3, pady=3)
|
||||||
if filebrowser:
|
if filebrowser:
|
||||||
b = tk.Button(f, text="...", command=lambda: self.open_file(e))
|
b = ttk.Button(f, text="...", command=lambda: self.open_file(e))
|
||||||
b.grid(row=0, column=2, padx=3, pady=3)
|
b.grid(row=0, column=2, padx=3, pady=3)
|
||||||
f.grid(sticky=tk.E)
|
f.grid(sticky=tk.E)
|
||||||
|
|
||||||
def mobility_script_parameters(self):
|
def mobility_script_parameters(self):
|
||||||
lbl = tk.Label(self, text="node ns2script")
|
lbl = ttk.Label(self, text="node ns2script")
|
||||||
lbl.grid(sticky=tk.W + tk.E)
|
lbl.grid(sticky="ew")
|
||||||
|
|
||||||
sb = tk.Scrollbar(self, orient=tk.VERTICAL)
|
sb = ttk.Scrollbar(self, orient=tk.VERTICAL)
|
||||||
sb.grid(row=1, column=1, sticky=tk.N + tk.S + tk.E)
|
sb.grid(row=1, column=1, sticky="ns")
|
||||||
|
|
||||||
f = tk.Frame(self, bg="#d9d9d9")
|
f = ttk.Frame(self, bg="#d9d9d9")
|
||||||
lbl = tk.Label(
|
lbl = ttk.Label(
|
||||||
f, text="ns-2 Mobility Scripts Parameters", bg="#d9d9d9", relief=tk.RAISED
|
f, text="ns-2 Mobility Scripts Parameters", bg="#d9d9d9", relief=tk.RAISED
|
||||||
)
|
)
|
||||||
lbl.grid(row=0, column=0, sticky=tk.W)
|
lbl.grid(row=0, column=0, sticky=tk.W)
|
||||||
|
@ -99,21 +98,21 @@ class MobilityConfiguration(Dialog):
|
||||||
f1, "Refresh time (ms)", self.node_config["refresh_ms"]
|
f1, "Refresh time (ms)", self.node_config["refresh_ms"]
|
||||||
)
|
)
|
||||||
|
|
||||||
# f12 = tk.Frame(f1)
|
# f12 = ttk.Frame(f1)
|
||||||
#
|
#
|
||||||
# lbl = tk.Label(f12, text="Refresh time (ms)")
|
# lbl = ttk.Label(f12, text="Refresh time (ms)")
|
||||||
# lbl.grid()
|
# lbl.grid()
|
||||||
#
|
#
|
||||||
# e = tk.Entry(f12, textvariable=self.create_string_var("50"))
|
# e = ttk.Entry(f12, textvariable=self.create_string_var("50"))
|
||||||
# e.grid(row=0, column=1)
|
# e.grid(row=0, column=1)
|
||||||
# f12.grid()
|
# f12.grid()
|
||||||
|
|
||||||
f13 = tk.Frame(f1)
|
f13 = ttk.Frame(f1)
|
||||||
|
|
||||||
lbl = tk.Label(f13, text="loop")
|
lbl = ttk.Label(f13, text="loop")
|
||||||
lbl.grid()
|
lbl.grid()
|
||||||
|
|
||||||
om = tk.OptionMenu(
|
om = ttk.OptionMenu(
|
||||||
f13, self.create_string_var("On"), "On", "Off", command=self.set_loop_value
|
f13, self.create_string_var("On"), "On", "Off", command=self.set_loop_value
|
||||||
)
|
)
|
||||||
om.grid(row=0, column=1)
|
om.grid(row=0, column=1)
|
||||||
|
@ -123,24 +122,24 @@ class MobilityConfiguration(Dialog):
|
||||||
self.create_label_entry_filebrowser(
|
self.create_label_entry_filebrowser(
|
||||||
f1, "auto-start seconds (0.0 for runtime)", self.node_config["autostart"]
|
f1, "auto-start seconds (0.0 for runtime)", self.node_config["autostart"]
|
||||||
)
|
)
|
||||||
# f14 = tk.Frame(f1)
|
# f14 = ttk.Frame(f1)
|
||||||
#
|
#
|
||||||
# lbl = tk.Label(f14, text="auto-start seconds (0.0 for runtime)")
|
# lbl = ttk.Label(f14, text="auto-start seconds (0.0 for runtime)")
|
||||||
# lbl.grid()
|
# lbl.grid()
|
||||||
#
|
#
|
||||||
# e = tk.Entry(f14, textvariable=self.create_string_var(""))
|
# e = ttk.Entry(f14, textvariable=self.create_string_var(""))
|
||||||
# e.grid(row=0, column=1)
|
# e.grid(row=0, column=1)
|
||||||
#
|
#
|
||||||
# f14.grid()
|
# f14.grid()
|
||||||
self.create_label_entry_filebrowser(
|
self.create_label_entry_filebrowser(
|
||||||
f1, "node mapping (optional, e.g. 0:1, 1:2, 2:3)", self.node_config["map"]
|
f1, "node mapping (optional, e.g. 0:1, 1:2, 2:3)", self.node_config["map"]
|
||||||
)
|
)
|
||||||
# f15 = tk.Frame(f1)
|
# f15 = ttk.Frame(f1)
|
||||||
#
|
#
|
||||||
# lbl = tk.Label(f15, text="node mapping (optional, e.g. 0:1, 1:2, 2:3)")
|
# lbl = ttk.Label(f15, text="node mapping (optional, e.g. 0:1, 1:2, 2:3)")
|
||||||
# lbl.grid()
|
# lbl.grid()
|
||||||
#
|
#
|
||||||
# e = tk.Entry(f15, textvariable=self.create_string_var(""))
|
# e = ttk.Entry(f15, textvariable=self.create_string_var(""))
|
||||||
# e.grid(row=0, column=1)
|
# e.grid(row=0, column=1)
|
||||||
#
|
#
|
||||||
# f15.grid()
|
# f15.grid()
|
||||||
|
@ -230,9 +229,9 @@ class MobilityConfiguration(Dialog):
|
||||||
|
|
||||||
:return: nothing
|
:return: nothing
|
||||||
"""
|
"""
|
||||||
f = tk.Frame(self)
|
f = ttk.Frame(self)
|
||||||
b = tk.Button(f, text="Apply", command=self.ns2script_apply)
|
b = ttk.Button(f, text="Apply", command=self.ns2script_apply)
|
||||||
b.grid()
|
b.grid()
|
||||||
b = tk.Button(f, text="Cancel", command=self.destroy)
|
b = ttk.Button(f, text="Cancel", command=self.destroy)
|
||||||
b.grid(row=0, column=1)
|
b.grid(row=0, column=1)
|
||||||
f.grid()
|
f.grid()
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
import tkinter as tk
|
import tkinter as tk
|
||||||
from tkinter import ttk
|
from tkinter import ttk
|
||||||
|
|
||||||
|
from coretk.coreclient import DEFAULT_NODES
|
||||||
from coretk.dialogs.dialog import Dialog
|
from coretk.dialogs.dialog import Dialog
|
||||||
from coretk.dialogs.icondialog import IconDialog
|
from coretk.dialogs.icondialog import IconDialog
|
||||||
from coretk.dialogs.nodeservice import NodeServicesDialog
|
from coretk.dialogs.nodeservice import NodeServicesDialog
|
||||||
|
|
||||||
NETWORKNODETYPES = ["switch", "hub", "wlan", "rj45", "tunnel"]
|
|
||||||
DEFAULTNODES = ["router", "host", "PC"]
|
|
||||||
|
|
||||||
|
|
||||||
class NodeConfigDialog(Dialog):
|
class NodeConfigDialog(Dialog):
|
||||||
def __init__(self, master, app, canvas_node):
|
def __init__(self, master, app, canvas_node):
|
||||||
|
@ -34,17 +32,17 @@ class NodeConfigDialog(Dialog):
|
||||||
self.draw_third_row()
|
self.draw_third_row()
|
||||||
|
|
||||||
def draw_first_row(self):
|
def draw_first_row(self):
|
||||||
frame = tk.Frame(self)
|
frame = ttk.Frame(self)
|
||||||
frame.grid(row=0, column=0, pady=2, sticky="ew")
|
frame.grid(row=0, column=0, pady=2, sticky="ew")
|
||||||
frame.columnconfigure(0, weight=1)
|
frame.columnconfigure(0, weight=1)
|
||||||
frame.columnconfigure(1, weight=1)
|
frame.columnconfigure(1, weight=1)
|
||||||
frame.columnconfigure(2, weight=1)
|
frame.columnconfigure(2, weight=1)
|
||||||
|
|
||||||
entry = tk.Entry(frame, textvariable=self.name)
|
entry = ttk.Entry(frame, textvariable=self.name)
|
||||||
entry.grid(row=0, column=0, padx=2, sticky="ew")
|
entry.grid(row=0, column=0, padx=2, sticky="ew")
|
||||||
|
|
||||||
combobox = ttk.Combobox(
|
combobox = ttk.Combobox(
|
||||||
frame, textvariable=self.type, values=DEFAULTNODES, state="readonly"
|
frame, textvariable=self.type, values=DEFAULT_NODES, state="readonly"
|
||||||
)
|
)
|
||||||
combobox.grid(row=0, column=1, padx=2, sticky="ew")
|
combobox.grid(row=0, column=1, padx=2, sticky="ew")
|
||||||
|
|
||||||
|
@ -57,15 +55,15 @@ class NodeConfigDialog(Dialog):
|
||||||
combobox.grid(row=0, column=2, sticky="ew")
|
combobox.grid(row=0, column=2, sticky="ew")
|
||||||
|
|
||||||
def draw_second_row(self):
|
def draw_second_row(self):
|
||||||
frame = tk.Frame(self)
|
frame = ttk.Frame(self)
|
||||||
frame.grid(row=1, column=0, pady=2, sticky="ew")
|
frame.grid(row=1, column=0, pady=2, sticky="ew")
|
||||||
frame.columnconfigure(0, weight=1)
|
frame.columnconfigure(0, weight=1)
|
||||||
frame.columnconfigure(1, weight=1)
|
frame.columnconfigure(1, weight=1)
|
||||||
|
|
||||||
button = tk.Button(frame, text="Services", command=self.click_services)
|
button = ttk.Button(frame, text="Services", command=self.click_services)
|
||||||
button.grid(row=0, column=0, padx=2, sticky="ew")
|
button.grid(row=0, column=0, padx=2, sticky="ew")
|
||||||
|
|
||||||
self.image_button = tk.Button(
|
self.image_button = ttk.Button(
|
||||||
frame,
|
frame,
|
||||||
text="Icon",
|
text="Icon",
|
||||||
image=self.image,
|
image=self.image,
|
||||||
|
@ -75,15 +73,15 @@ class NodeConfigDialog(Dialog):
|
||||||
self.image_button.grid(row=0, column=1, sticky="ew")
|
self.image_button.grid(row=0, column=1, sticky="ew")
|
||||||
|
|
||||||
def draw_third_row(self):
|
def draw_third_row(self):
|
||||||
frame = tk.Frame(self)
|
frame = ttk.Frame(self)
|
||||||
frame.grid(row=2, column=0, sticky="ew")
|
frame.grid(row=2, column=0, sticky="ew")
|
||||||
frame.columnconfigure(0, weight=1)
|
frame.columnconfigure(0, weight=1)
|
||||||
frame.columnconfigure(1, weight=1)
|
frame.columnconfigure(1, weight=1)
|
||||||
|
|
||||||
button = tk.Button(frame, text="Apply", command=self.config_apply)
|
button = ttk.Button(frame, text="Apply", command=self.config_apply)
|
||||||
button.grid(row=0, column=0, padx=2, sticky="ew")
|
button.grid(row=0, column=0, padx=2, sticky="ew")
|
||||||
|
|
||||||
button = tk.Button(frame, text="Cancel", command=self.destroy)
|
button = ttk.Button(frame, text="Cancel", command=self.destroy)
|
||||||
button.grid(row=0, column=1, sticky="ew")
|
button.grid(row=0, column=1, sticky="ew")
|
||||||
|
|
||||||
def click_services(self):
|
def click_services(self):
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
core node services
|
core node services
|
||||||
"""
|
"""
|
||||||
import tkinter as tk
|
import tkinter as tk
|
||||||
from tkinter import messagebox
|
from tkinter import messagebox, ttk
|
||||||
|
|
||||||
from coretk.dialogs.dialog import Dialog
|
from coretk.dialogs.dialog import Dialog
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ class NodeServicesDialog(Dialog):
|
||||||
def draw(self):
|
def draw(self):
|
||||||
self.columnconfigure(0, weight=1)
|
self.columnconfigure(0, weight=1)
|
||||||
self.rowconfigure(0, weight=1)
|
self.rowconfigure(0, weight=1)
|
||||||
self.config_frame = tk.Frame(self)
|
self.config_frame = ttk.Frame(self)
|
||||||
self.config_frame.columnconfigure(0, weight=1)
|
self.config_frame.columnconfigure(0, weight=1)
|
||||||
self.config_frame.columnconfigure(1, weight=1)
|
self.config_frame.columnconfigure(1, weight=1)
|
||||||
self.config_frame.columnconfigure(2, weight=1)
|
self.config_frame.columnconfigure(2, weight=1)
|
||||||
|
@ -37,15 +37,15 @@ class NodeServicesDialog(Dialog):
|
||||||
|
|
||||||
:return: nothing
|
:return: nothing
|
||||||
"""
|
"""
|
||||||
frame = tk.Frame(self.config_frame)
|
frame = ttk.Frame(self.config_frame)
|
||||||
frame.columnconfigure(0, weight=1)
|
frame.columnconfigure(0, weight=1)
|
||||||
frame.rowconfigure(1, weight=1)
|
frame.rowconfigure(1, weight=1)
|
||||||
frame.grid(row=0, column=0, padx=3, pady=3, sticky="nsew")
|
frame.grid(row=0, column=0, padx=3, pady=3, sticky="nsew")
|
||||||
|
|
||||||
label = tk.Label(frame, text="Group")
|
label = ttk.Label(frame, text="Group")
|
||||||
label.grid(row=0, column=0, sticky="ew")
|
label.grid(row=0, column=0, sticky="ew")
|
||||||
|
|
||||||
scrollbar = tk.Scrollbar(frame, orient=tk.VERTICAL)
|
scrollbar = ttk.Scrollbar(frame, orient=tk.VERTICAL)
|
||||||
scrollbar.grid(row=1, column=1, sticky="ns")
|
scrollbar.grid(row=1, column=1, sticky="ns")
|
||||||
|
|
||||||
listbox = tk.Listbox(
|
listbox = tk.Listbox(
|
||||||
|
@ -65,15 +65,15 @@ class NodeServicesDialog(Dialog):
|
||||||
scrollbar.config(command=listbox.yview)
|
scrollbar.config(command=listbox.yview)
|
||||||
|
|
||||||
def draw_services(self):
|
def draw_services(self):
|
||||||
frame = tk.Frame(self.config_frame)
|
frame = ttk.Frame(self.config_frame)
|
||||||
frame.columnconfigure(0, weight=1)
|
frame.columnconfigure(0, weight=1)
|
||||||
frame.rowconfigure(1, weight=1)
|
frame.rowconfigure(1, weight=1)
|
||||||
frame.grid(row=0, column=1, padx=3, pady=3, sticky="nsew")
|
frame.grid(row=0, column=1, padx=3, pady=3, sticky="nsew")
|
||||||
|
|
||||||
label = tk.Label(frame, text="Group services")
|
label = ttk.Label(frame, text="Group services")
|
||||||
label.grid(row=0, column=0, sticky="ew")
|
label.grid(row=0, column=0, sticky="ew")
|
||||||
|
|
||||||
scrollbar = tk.Scrollbar(frame, orient=tk.VERTICAL)
|
scrollbar = ttk.Scrollbar(frame, orient=tk.VERTICAL)
|
||||||
scrollbar.grid(row=1, column=1, sticky="ns")
|
scrollbar.grid(row=1, column=1, sticky="ns")
|
||||||
|
|
||||||
self.services_list = tk.Listbox(
|
self.services_list = tk.Listbox(
|
||||||
|
@ -90,15 +90,15 @@ class NodeServicesDialog(Dialog):
|
||||||
scrollbar.config(command=self.services_list.yview)
|
scrollbar.config(command=self.services_list.yview)
|
||||||
|
|
||||||
def draw_current_services(self):
|
def draw_current_services(self):
|
||||||
frame = tk.Frame(self.config_frame)
|
frame = ttk.Frame(self.config_frame)
|
||||||
frame.columnconfigure(0, weight=1)
|
frame.columnconfigure(0, weight=1)
|
||||||
frame.rowconfigure(1, weight=1)
|
frame.rowconfigure(1, weight=1)
|
||||||
frame.grid(row=0, column=2, padx=3, pady=3, sticky="nsew")
|
frame.grid(row=0, column=2, padx=3, pady=3, sticky="nsew")
|
||||||
|
|
||||||
label = tk.Label(frame, text="Current services")
|
label = ttk.Label(frame, text="Current services")
|
||||||
label.grid(row=0, column=0, sticky="ew")
|
label.grid(row=0, column=0, sticky="ew")
|
||||||
|
|
||||||
scrollbar = tk.Scrollbar(frame, orient=tk.VERTICAL)
|
scrollbar = ttk.Scrollbar(frame, orient=tk.VERTICAL)
|
||||||
scrollbar.grid(row=1, column=1, sticky="ns")
|
scrollbar.grid(row=1, column=1, sticky="ns")
|
||||||
|
|
||||||
listbox = tk.Listbox(
|
listbox = tk.Listbox(
|
||||||
|
@ -114,19 +114,19 @@ class NodeServicesDialog(Dialog):
|
||||||
scrollbar.config(command=listbox.yview)
|
scrollbar.config(command=listbox.yview)
|
||||||
|
|
||||||
def draw_buttons(self):
|
def draw_buttons(self):
|
||||||
frame = tk.Frame(self)
|
frame = ttk.Frame(self)
|
||||||
frame.columnconfigure(0, weight=1)
|
frame.columnconfigure(0, weight=1)
|
||||||
frame.columnconfigure(1, weight=1)
|
frame.columnconfigure(1, weight=1)
|
||||||
frame.columnconfigure(2, weight=1)
|
frame.columnconfigure(2, weight=1)
|
||||||
frame.grid(row=1, column=0, sticky="ew")
|
frame.grid(row=1, column=0, sticky="ew")
|
||||||
|
|
||||||
button = tk.Button(frame, text="Configure", command=self.click_configure)
|
button = ttk.Button(frame, text="Configure", command=self.click_configure)
|
||||||
button.grid(row=0, column=0, sticky="ew")
|
button.grid(row=0, column=0, sticky="ew")
|
||||||
|
|
||||||
button = tk.Button(frame, text="Apply")
|
button = ttk.Button(frame, text="Apply")
|
||||||
button.grid(row=0, column=1, sticky="ew")
|
button.grid(row=0, column=1, sticky="ew")
|
||||||
|
|
||||||
button = tk.Button(frame, text="Cancel", command=self.destroy)
|
button = ttk.Button(frame, text="Cancel", command=self.destroy)
|
||||||
button.grid(row=0, column=2, sticky="ew")
|
button.grid(row=0, column=2, sticky="ew")
|
||||||
|
|
||||||
def handle_group_change(self, event):
|
def handle_group_change(self, event):
|
||||||
|
|
|
@ -3,6 +3,7 @@ wlan configuration
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import tkinter as tk
|
import tkinter as tk
|
||||||
|
from tkinter import ttk
|
||||||
|
|
||||||
from coretk.dialogs.dialog import Dialog
|
from coretk.dialogs.dialog import Dialog
|
||||||
from coretk.dialogs.icondialog import IconDialog
|
from coretk.dialogs.icondialog import IconDialog
|
||||||
|
@ -10,12 +11,6 @@ from coretk.dialogs.icondialog import IconDialog
|
||||||
|
|
||||||
class WlanConfigDialog(Dialog):
|
class WlanConfigDialog(Dialog):
|
||||||
def __init__(self, master, app, canvas_node, config):
|
def __init__(self, master, app, canvas_node, config):
|
||||||
"""
|
|
||||||
create an instance of WlanConfiguration
|
|
||||||
|
|
||||||
:param coretk.grpah.CanvasGraph canvas: canvas object
|
|
||||||
:param coretk.graph.CanvasNode canvas_node: canvas node object
|
|
||||||
"""
|
|
||||||
super().__init__(
|
super().__init__(
|
||||||
master, app, f"{canvas_node.name} Wlan Configuration", modal=True
|
master, app, f"{canvas_node.name} Wlan Configuration", modal=True
|
||||||
)
|
)
|
||||||
|
@ -48,14 +43,14 @@ class WlanConfigDialog(Dialog):
|
||||||
|
|
||||||
:return: nothing
|
:return: nothing
|
||||||
"""
|
"""
|
||||||
frame = tk.Frame(self)
|
frame = ttk.Frame(self)
|
||||||
frame.grid(pady=2, sticky="ew")
|
frame.grid(pady=2, sticky="ew")
|
||||||
frame.columnconfigure(0, weight=1)
|
frame.columnconfigure(0, weight=1)
|
||||||
|
|
||||||
entry = tk.Entry(frame, textvariable=self.name, bg="white")
|
entry = ttk.Entry(frame, textvariable=self.name)
|
||||||
entry.grid(row=0, column=0, padx=2, sticky="ew")
|
entry.grid(row=0, column=0, padx=2, sticky="ew")
|
||||||
|
|
||||||
self.image_button = tk.Button(frame, image=self.image, command=self.click_icon)
|
self.image_button = ttk.Button(frame, image=self.image, command=self.click_icon)
|
||||||
self.image_button.grid(row=0, column=1, padx=3)
|
self.image_button.grid(row=0, column=1, padx=3)
|
||||||
|
|
||||||
def draw_wlan_config(self):
|
def draw_wlan_config(self):
|
||||||
|
@ -64,15 +59,15 @@ class WlanConfigDialog(Dialog):
|
||||||
|
|
||||||
:return: nothing
|
:return: nothing
|
||||||
"""
|
"""
|
||||||
label = tk.Label(self, text="Wireless")
|
label = ttk.Label(self, text="Wireless")
|
||||||
label.grid(sticky="w", pady=2)
|
label.grid(sticky="w", pady=2)
|
||||||
|
|
||||||
frame = tk.Frame(self)
|
frame = ttk.Frame(self)
|
||||||
frame.grid(pady=2, sticky="ew")
|
frame.grid(pady=2, sticky="ew")
|
||||||
for i in range(2):
|
for i in range(2):
|
||||||
frame.columnconfigure(i, weight=1)
|
frame.columnconfigure(i, weight=1)
|
||||||
|
|
||||||
label = tk.Label(
|
label = ttk.Label(
|
||||||
frame,
|
frame,
|
||||||
text=(
|
text=(
|
||||||
"The basic range model calculates on/off "
|
"The basic range model calculates on/off "
|
||||||
|
@ -81,29 +76,29 @@ class WlanConfigDialog(Dialog):
|
||||||
)
|
)
|
||||||
label.grid(row=0, columnspan=2, pady=2, sticky="ew")
|
label.grid(row=0, columnspan=2, pady=2, sticky="ew")
|
||||||
|
|
||||||
label = tk.Label(frame, text="Range")
|
label = ttk.Label(frame, text="Range")
|
||||||
label.grid(row=1, column=0, sticky="w")
|
label.grid(row=1, column=0, sticky="w")
|
||||||
entry = tk.Entry(frame, textvariable=self.range_var)
|
entry = ttk.Entry(frame, textvariable=self.range_var)
|
||||||
entry.grid(row=1, column=1, sticky="ew")
|
entry.grid(row=1, column=1, sticky="ew")
|
||||||
|
|
||||||
label = tk.Label(frame, text="Bandwidth (bps)")
|
label = ttk.Label(frame, text="Bandwidth (bps)")
|
||||||
label.grid(row=2, column=0, sticky="w")
|
label.grid(row=2, column=0, sticky="w")
|
||||||
entry = tk.Entry(frame, textvariable=self.bandwidth_var)
|
entry = ttk.Entry(frame, textvariable=self.bandwidth_var)
|
||||||
entry.grid(row=2, column=1, sticky="ew")
|
entry.grid(row=2, column=1, sticky="ew")
|
||||||
|
|
||||||
label = tk.Label(frame, text="Delay (us)")
|
label = ttk.Label(frame, text="Delay (us)")
|
||||||
label.grid(row=3, column=0, sticky="w")
|
label.grid(row=3, column=0, sticky="w")
|
||||||
entry = tk.Entry(frame, textvariable=self.delay_var)
|
entry = ttk.Entry(frame, textvariable=self.delay_var)
|
||||||
entry.grid(row=3, column=1, sticky="ew")
|
entry.grid(row=3, column=1, sticky="ew")
|
||||||
|
|
||||||
label = tk.Label(frame, text="Loss (%)")
|
label = ttk.Label(frame, text="Loss (%)")
|
||||||
label.grid(row=4, column=0, sticky="w")
|
label.grid(row=4, column=0, sticky="w")
|
||||||
entry = tk.Entry(frame, textvariable=self.loss_var)
|
entry = ttk.Entry(frame, textvariable=self.loss_var)
|
||||||
entry.grid(row=4, column=1, sticky="ew")
|
entry.grid(row=4, column=1, sticky="ew")
|
||||||
|
|
||||||
label = tk.Label(frame, text="Jitter (us)")
|
label = ttk.Label(frame, text="Jitter (us)")
|
||||||
label.grid(row=5, column=0, sticky="w")
|
label.grid(row=5, column=0, sticky="w")
|
||||||
entry = tk.Entry(frame, textvariable=self.jitter_var)
|
entry = ttk.Entry(frame, textvariable=self.jitter_var)
|
||||||
entry.grid(row=5, column=1, sticky="ew")
|
entry.grid(row=5, column=1, sticky="ew")
|
||||||
|
|
||||||
def draw_subnet(self):
|
def draw_subnet(self):
|
||||||
|
@ -113,19 +108,19 @@ class WlanConfigDialog(Dialog):
|
||||||
:return: nothing
|
:return: nothing
|
||||||
"""
|
"""
|
||||||
|
|
||||||
frame = tk.Frame(self)
|
frame = ttk.Frame(self)
|
||||||
frame.grid(pady=3, sticky="ew")
|
frame.grid(pady=3, sticky="ew")
|
||||||
frame.columnconfigure(1, weight=1)
|
frame.columnconfigure(1, weight=1)
|
||||||
frame.columnconfigure(3, weight=1)
|
frame.columnconfigure(3, weight=1)
|
||||||
|
|
||||||
label = tk.Label(frame, text="IPv4 Subnet")
|
label = ttk.Label(frame, text="IPv4 Subnet")
|
||||||
label.grid(row=0, column=0, sticky="w")
|
label.grid(row=0, column=0, sticky="w")
|
||||||
entry = tk.Entry(frame, textvariable=self.ip4_subnet)
|
entry = ttk.Entry(frame, textvariable=self.ip4_subnet)
|
||||||
entry.grid(row=0, column=1, sticky="ew")
|
entry.grid(row=0, column=1, sticky="ew")
|
||||||
|
|
||||||
label = tk.Label(frame, text="IPv6 Subnet")
|
label = ttk.Label(frame, text="IPv6 Subnet")
|
||||||
label.grid(row=0, column=2, sticky="w")
|
label.grid(row=0, column=2, sticky="w")
|
||||||
entry = tk.Entry(frame, textvariable=self.ip6_subnet)
|
entry = ttk.Entry(frame, textvariable=self.ip6_subnet)
|
||||||
entry.grid(row=0, column=3, sticky="ew")
|
entry.grid(row=0, column=3, sticky="ew")
|
||||||
|
|
||||||
def draw_wlan_buttons(self):
|
def draw_wlan_buttons(self):
|
||||||
|
@ -135,18 +130,18 @@ class WlanConfigDialog(Dialog):
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
frame = tk.Frame(self)
|
frame = ttk.Frame(self)
|
||||||
frame.grid(pady=2, sticky="ew")
|
frame.grid(pady=2, sticky="ew")
|
||||||
for i in range(3):
|
for i in range(3):
|
||||||
frame.columnconfigure(i, weight=1)
|
frame.columnconfigure(i, weight=1)
|
||||||
|
|
||||||
button = tk.Button(frame, text="ns-2 mobility script...")
|
button = ttk.Button(frame, text="ns-2 mobility script...")
|
||||||
button.grid(row=0, column=0, padx=2, sticky="ew")
|
button.grid(row=0, column=0, padx=2, sticky="ew")
|
||||||
|
|
||||||
button = tk.Button(frame, text="Link to all routers")
|
button = ttk.Button(frame, text="Link to all routers")
|
||||||
button.grid(row=0, column=1, padx=2, sticky="ew")
|
button.grid(row=0, column=1, padx=2, sticky="ew")
|
||||||
|
|
||||||
button = tk.Button(frame, text="Choose WLAN members")
|
button = ttk.Button(frame, text="Choose WLAN members")
|
||||||
button.grid(row=0, column=2, padx=2, sticky="ew")
|
button.grid(row=0, column=2, padx=2, sticky="ew")
|
||||||
|
|
||||||
def draw_apply_buttons(self):
|
def draw_apply_buttons(self):
|
||||||
|
@ -155,15 +150,15 @@ class WlanConfigDialog(Dialog):
|
||||||
|
|
||||||
:return: nothing
|
:return: nothing
|
||||||
"""
|
"""
|
||||||
frame = tk.Frame(self)
|
frame = ttk.Frame(self)
|
||||||
frame.grid(sticky="ew")
|
frame.grid(sticky="ew")
|
||||||
for i in range(2):
|
for i in range(2):
|
||||||
frame.columnconfigure(i, weight=1)
|
frame.columnconfigure(i, weight=1)
|
||||||
|
|
||||||
button = tk.Button(frame, text="Apply", command=self.click_apply)
|
button = ttk.Button(frame, text="Apply", command=self.click_apply)
|
||||||
button.grid(row=0, column=0, padx=2, sticky="ew")
|
button.grid(row=0, column=0, padx=2, sticky="ew")
|
||||||
|
|
||||||
button = tk.Button(frame, text="Cancel", command=self.destroy)
|
button = ttk.Button(frame, text="Cancel", command=self.destroy)
|
||||||
button.grid(row=0, column=1, padx=2, sticky="ew")
|
button.grid(row=0, column=1, padx=2, sticky="ew")
|
||||||
|
|
||||||
def click_icon(self):
|
def click_icon(self):
|
||||||
|
@ -188,7 +183,6 @@ class WlanConfigDialog(Dialog):
|
||||||
jitter = self.jitter_var.get()
|
jitter = self.jitter_var.get()
|
||||||
|
|
||||||
# set wireless node configuration here
|
# set wireless node configuration here
|
||||||
|
|
||||||
wlanconfig_manager = self.app.core.wlanconfig_management
|
wlanconfig_manager = self.app.core.wlanconfig_management
|
||||||
wlanconfig_manager.set_custom_config(
|
wlanconfig_manager.set_custom_config(
|
||||||
node_id=self.canvas_node.core_id,
|
node_id=self.canvas_node.core_id,
|
||||||
|
|
Loading…
Add table
Reference in a new issue