Merge branch 'develop' of https://github.com/coreemu/core into develop

This commit is contained in:
Blake Harnden 2019-12-20 13:31:32 -08:00
commit 5639aeab75
3 changed files with 106 additions and 1 deletions

View file

@ -0,0 +1,97 @@
"""
throughput dialog
"""
import logging
import tkinter as tk
from tkinter import ttk
from core.gui.dialogs.dialog import Dialog
class ThroughputDialog(Dialog):
def __init__(self, master, app):
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)
self.transmission = tk.IntVar(value=1)
self.reception = tk.IntVar(value=1)
self.threshold = tk.DoubleVar(value=250.0)
self.width = tk.IntVar(value=10)
self.top.columnconfigure(0, weight=1)
self.draw()
def draw(self):
button = ttk.Checkbutton(
self.top,
variable=self.show_throughput,
text="Show throughput level on every link",
)
button.grid(row=0, column=0, sticky="nsew")
button = ttk.Checkbutton(
self.top,
variable=self.exponential_weight,
text="Use exponential weighted moving average",
)
button.grid(row=1, column=0, sticky="nsew")
button = ttk.Checkbutton(
self.top, variable=self.transmission, text="Include transmissions"
)
button.grid(row=2, column=0, sticky="nsew")
button = ttk.Checkbutton(
self.top, variable=self.reception, text="Include receptions"
)
button.grid(row=3, column=0, sticky="nsew")
label_frame = ttk.LabelFrame(self.top, text="Link highlight")
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")
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")
label = ttk.Label(frame, text="Threshold (0 for disabled)")
label.grid(row=0, column=0, sticky="nsew")
entry = ttk.Entry(frame, textvariable=self.threshold)
entry.grid(row=0, column=1, sticky="nsew")
label = ttk.Label(frame, text="kbps")
label.grid(row=0, column=2, sticky="nsew")
scale = ttk.Scale(
label_frame,
from_=0,
to=1000,
value=0,
orient=tk.HORIZONTAL,
variable=self.threshold,
)
scale.grid(row=2, column=0, sticky="nsew")
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")
entry = ttk.Entry(frame, textvariable=self.width)
entry.grid(row=0, column=1, sticky="nsew")
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")
button = ttk.Button(self.top, text="OK", command=self.ok)
button.grid(row=5, column=0, sticky="nsew")
def ok(self):
logging.debug("click ok")
self.destroy()

View file

@ -20,6 +20,7 @@ from core.gui.dialogs.preferences import PreferencesDialog
from core.gui.dialogs.servers import ServersDialog
from core.gui.dialogs.sessionoptions import SessionOptionsDialog
from core.gui.dialogs.sessions import SessionsDialog
from core.gui.dialogs.throughput import ThroughputDialog
class MenuAction:
@ -161,3 +162,8 @@ class MenuAction:
def paste(self, event=None):
logging.debug("paste")
self.app.canvas.paste()
def config_throughput(self):
logging.debug("not implemented")
dialog = ThroughputDialog(self.app, self.app)
dialog.show()

View file

@ -435,7 +435,9 @@ class Menubar(tk.Menu):
menu.add_checkbutton(label="Throughput", command=self.menuaction.throughput)
menu.add_separator()
menu.add_command(label="Configure Adjacency...", state=tk.DISABLED)
menu.add_command(label="Configure Throughput...", state=tk.DISABLED)
menu.add_command(
label="Configure Throughput...", command=self.menuaction.config_throughput
)
self.add_cascade(label="Widgets", menu=menu)
def draw_session_menu(self):