small tweaks to throughput config dialog
This commit is contained in:
parent
fe8bc6f10e
commit
3512eedc60
2 changed files with 44 additions and 30 deletions
|
@ -135,9 +135,8 @@ class ShapeDialog(Dialog):
|
|||
button.grid(row=0, column=1, sticky="ew")
|
||||
|
||||
def choose_text_color(self):
|
||||
color_picker = ColorPickerDialog(self, self.app, "#000000")
|
||||
color = color_picker.askcolor()
|
||||
self.text_color = color
|
||||
color_picker = ColorPickerDialog(self, self.app, self.text_color)
|
||||
self.text_color = color_picker.askcolor()
|
||||
|
||||
def choose_fill_color(self):
|
||||
color_picker = ColorPickerDialog(self, self.app, self.fill_color)
|
||||
|
|
|
@ -5,12 +5,14 @@ import logging
|
|||
import tkinter as tk
|
||||
from tkinter import ttk
|
||||
|
||||
from core.gui.dialogs.colorpicker import ColorPickerDialog
|
||||
from core.gui.dialogs.dialog import Dialog
|
||||
from core.gui.themes import FRAME_PAD, PADY
|
||||
|
||||
|
||||
class ThroughputDialog(Dialog):
|
||||
def __init__(self, master, app):
|
||||
super().__init__(master, app, "throughput config", modal=False)
|
||||
super().__init__(master, app, "Throughput Config", modal=False)
|
||||
self.app = app
|
||||
self.show_throughput = tk.IntVar(value=1)
|
||||
self.exponential_weight = tk.IntVar(value=1)
|
||||
|
@ -18,6 +20,8 @@ class ThroughputDialog(Dialog):
|
|||
self.reception = tk.IntVar(value=1)
|
||||
self.threshold = tk.DoubleVar(value=250.0)
|
||||
self.width = tk.IntVar(value=10)
|
||||
self.color = "#FF0000"
|
||||
self.color_button = None
|
||||
self.top.columnconfigure(0, weight=1)
|
||||
self.draw()
|
||||
|
||||
|
@ -25,41 +29,41 @@ class ThroughputDialog(Dialog):
|
|||
button = ttk.Checkbutton(
|
||||
self.top,
|
||||
variable=self.show_throughput,
|
||||
text="Show throughput level on every link",
|
||||
text="Show Throughput Level On Every Link",
|
||||
)
|
||||
button.grid(row=0, column=0, sticky="nsew")
|
||||
button.grid(row=0, column=0, sticky="ew")
|
||||
button = ttk.Checkbutton(
|
||||
self.top,
|
||||
variable=self.exponential_weight,
|
||||
text="Use exponential weighted moving average",
|
||||
text="Use Exponential Weighted Moving Average",
|
||||
)
|
||||
button.grid(row=1, column=0, sticky="nsew")
|
||||
button.grid(row=1, column=0, sticky="ew")
|
||||
button = ttk.Checkbutton(
|
||||
self.top, variable=self.transmission, text="Include transmissions"
|
||||
self.top, variable=self.transmission, text="Include Transmissions"
|
||||
)
|
||||
button.grid(row=2, column=0, sticky="nsew")
|
||||
button.grid(row=2, column=0, sticky="ew")
|
||||
button = ttk.Checkbutton(
|
||||
self.top, variable=self.reception, text="Include receptions"
|
||||
self.top, variable=self.reception, text="Include Receptions"
|
||||
)
|
||||
button.grid(row=3, column=0, sticky="nsew")
|
||||
button.grid(row=3, column=0, sticky="ew")
|
||||
|
||||
label_frame = ttk.LabelFrame(self.top, text="Link highlight")
|
||||
label_frame = ttk.LabelFrame(self.top, text="Link Highlight", padding=FRAME_PAD)
|
||||
label_frame.columnconfigure(0, weight=1)
|
||||
label_frame.grid(row=4, column=0, sticky="nsew")
|
||||
label = ttk.Label(label_frame, text="Highlight link if throughput exceeds this")
|
||||
label.grid(row=0, column=0, sticky="nsew")
|
||||
label_frame.grid(row=4, column=0, sticky="ew")
|
||||
label = ttk.Label(label_frame, text="Highlight Link Throughput")
|
||||
label.grid(row=0, column=0, sticky="ew")
|
||||
|
||||
frame = ttk.Frame(label_frame)
|
||||
frame.columnconfigure(0, weight=2)
|
||||
frame.columnconfigure(1, weight=1)
|
||||
frame.columnconfigure(2, weight=1)
|
||||
frame.grid(row=1, column=0, sticky="nsew")
|
||||
frame.grid(row=1, column=0, sticky="ew")
|
||||
label = ttk.Label(frame, text="Threshold (0 for disabled)")
|
||||
label.grid(row=0, column=0, sticky="nsew")
|
||||
label.grid(row=0, column=0, sticky="ew")
|
||||
entry = ttk.Entry(frame, textvariable=self.threshold)
|
||||
entry.grid(row=0, column=1, sticky="nsew")
|
||||
entry.grid(row=0, column=1, sticky="ew")
|
||||
label = ttk.Label(frame, text="kbps")
|
||||
label.grid(row=0, column=2, sticky="nsew")
|
||||
label.grid(row=0, column=2, sticky="ew")
|
||||
|
||||
scale = ttk.Scale(
|
||||
label_frame,
|
||||
|
@ -69,28 +73,39 @@ class ThroughputDialog(Dialog):
|
|||
orient=tk.HORIZONTAL,
|
||||
variable=self.threshold,
|
||||
)
|
||||
scale.grid(row=2, column=0, sticky="nsew")
|
||||
scale.grid(row=2, column=0, sticky="ew", pady=PADY)
|
||||
|
||||
frame = ttk.Frame(label_frame)
|
||||
frame.columnconfigure(0, weight=1)
|
||||
frame.columnconfigure(1, weight=1)
|
||||
frame.grid(row=3, column=0, sticky="nsew")
|
||||
label = ttk.Label(frame, text="Highlight link width: ")
|
||||
label.grid(row=0, column=0, sticky="nsew")
|
||||
label = ttk.Label(frame, text="Highlight Link Width")
|
||||
label.grid(row=0, column=0, sticky="ew")
|
||||
entry = ttk.Entry(frame, textvariable=self.width)
|
||||
entry.grid(row=0, column=1, sticky="nsew")
|
||||
entry.grid(row=0, column=1, sticky="ew")
|
||||
|
||||
frame = ttk.Frame(label_frame)
|
||||
frame.columnconfigure(0, weight=1)
|
||||
frame.columnconfigure(1, weight=1)
|
||||
frame.grid(row=4, column=0, sticky="nsew")
|
||||
label = ttk.Label(frame, text="Color: ")
|
||||
label.grid(row=0, column=0, sticky="nsew")
|
||||
button = ttk.Button(frame, text="not implemented")
|
||||
button.grid(row=0, column=1, sticky="nsew")
|
||||
frame.grid(row=4, column=0, sticky="ew")
|
||||
label = ttk.Label(frame, text="Color")
|
||||
label.grid(row=0, column=0, sticky="ew")
|
||||
self.color_button = tk.Button(
|
||||
frame,
|
||||
text=self.color,
|
||||
command=self.click_color,
|
||||
bg=self.color,
|
||||
highlightthickness=0,
|
||||
)
|
||||
self.color_button.grid(row=0, column=1, sticky="ew")
|
||||
|
||||
button = ttk.Button(self.top, text="OK", command=self.ok)
|
||||
button.grid(row=5, column=0, sticky="nsew")
|
||||
button.grid(row=5, column=0, sticky="ew")
|
||||
|
||||
def click_color(self):
|
||||
color_picker = ColorPickerDialog(self, self.app, self.color)
|
||||
self.color = color_picker.askcolor()
|
||||
self.color_button.config(bg=self.color, text=self.color, bd=0)
|
||||
|
||||
def ok(self):
|
||||
logging.debug("click ok")
|
||||
|
|
Loading…
Reference in a new issue