-m
This commit is contained in:
parent
b9b8e3a5f1
commit
6c8a2526d9
40 changed files with 219 additions and 141 deletions
|
@ -35,7 +35,7 @@ THE POSSIBILITY OF SUCH DAMAGE.\
|
|||
|
||||
|
||||
class AboutDialog(Dialog):
|
||||
def __init__(self, master: tk.Widget, app: "Application"):
|
||||
def __init__(self, master: "Application", app: "Application"):
|
||||
super().__init__(master, app, "About CORE", modal=True)
|
||||
self.draw()
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ if TYPE_CHECKING:
|
|||
|
||||
|
||||
class AlertsDialog(Dialog):
|
||||
def __init__(self, master: tk.Widget, app: "Application"):
|
||||
def __init__(self, master: "Application", app: "Application"):
|
||||
super().__init__(master, app, "Alerts", modal=True)
|
||||
self.app = app
|
||||
self.tree = None
|
||||
|
@ -124,7 +124,7 @@ class AlertsDialog(Dialog):
|
|||
|
||||
|
||||
class DaemonLog(Dialog):
|
||||
def __init__(self, master, app):
|
||||
def __init__(self, master: tk.Widget, app: "Application"):
|
||||
super().__init__(master, app, "core-daemon log", modal=True)
|
||||
self.columnconfigure(0, weight=1)
|
||||
self.path = tk.StringVar(value="/var/log/core-daemon.log")
|
||||
|
|
|
@ -17,11 +17,9 @@ if TYPE_CHECKING:
|
|||
|
||||
|
||||
class CanvasWallpaperDialog(Dialog):
|
||||
def __init__(self, master: tk.Widget, app: "Application"):
|
||||
def __init__(self, master: "Application", app: "Application"):
|
||||
"""
|
||||
create an instance of CanvasWallpaper object
|
||||
|
||||
:param coretk.app.Application app: root application
|
||||
"""
|
||||
super().__init__(master, app, "Canvas Background", modal=True)
|
||||
self.canvas = self.app.canvas
|
||||
|
|
|
@ -4,7 +4,7 @@ custom color picker
|
|||
import logging
|
||||
import tkinter as tk
|
||||
from tkinter import ttk
|
||||
from typing import TYPE_CHECKING, Optional
|
||||
from typing import TYPE_CHECKING, Any, Optional
|
||||
|
||||
from core.gui.dialogs.dialog import Dialog
|
||||
|
||||
|
@ -14,10 +14,7 @@ if TYPE_CHECKING:
|
|||
|
||||
class ColorPickerDialog(Dialog):
|
||||
def __init__(
|
||||
self,
|
||||
master: tk.Widget,
|
||||
app: "Application",
|
||||
initcolor: Optional[str] = "#000000",
|
||||
self, master: Any, app: "Application", initcolor: Optional[str] = "#000000"
|
||||
):
|
||||
super().__init__(master, app, "color picker", modal=True)
|
||||
self.red_entry = None
|
||||
|
|
|
@ -5,7 +5,7 @@ copy service config dialog
|
|||
import logging
|
||||
import tkinter as tk
|
||||
from tkinter import ttk
|
||||
from typing import TYPE_CHECKING, Tuple
|
||||
from typing import TYPE_CHECKING, Any, Tuple
|
||||
|
||||
from core.gui.dialogs.dialog import Dialog
|
||||
from core.gui.themes import FRAME_PAD, PADX
|
||||
|
@ -13,11 +13,10 @@ from core.gui.widgets import CodeText
|
|||
|
||||
if TYPE_CHECKING:
|
||||
from core.gui.app import Application
|
||||
from core.gui.dialogs.serviceconfig import ServiceConfigDialog
|
||||
|
||||
|
||||
class CopyServiceConfigDialog(Dialog):
|
||||
def __init__(self, master: "ServiceConfigDialog", app: "Application", node_id: int):
|
||||
def __init__(self, master: Any, app: "Application", node_id: int):
|
||||
super().__init__(master, app, f"Copy services to node {node_id}", modal=True)
|
||||
self.parent = master
|
||||
self.app = app
|
||||
|
@ -133,6 +132,7 @@ class CopyServiceConfigDialog(Dialog):
|
|||
|
||||
def click_view(self):
|
||||
selected = self.tree.selection()
|
||||
data = ""
|
||||
if selected:
|
||||
item = self.tree.item(selected[0])
|
||||
if "file" in item["tags"]:
|
||||
|
@ -161,7 +161,7 @@ class CopyServiceConfigDialog(Dialog):
|
|||
|
||||
|
||||
class ViewConfigDialog(Dialog):
|
||||
def __init__(self, master, app, node_id, data):
|
||||
def __init__(self, master: Any, app: "Application", node_id: int, data: bytes):
|
||||
super().__init__(master, app, f"n{node_id} config data", modal=True)
|
||||
self.data = data
|
||||
self.service_data = None
|
||||
|
|
|
@ -2,7 +2,7 @@ import logging
|
|||
import tkinter as tk
|
||||
from pathlib import Path
|
||||
from tkinter import ttk
|
||||
from typing import TYPE_CHECKING, Set
|
||||
from typing import TYPE_CHECKING, Any, Set
|
||||
|
||||
from core.gui import nodeutils
|
||||
from core.gui.appconfig import ICONS_PATH
|
||||
|
@ -17,7 +17,7 @@ if TYPE_CHECKING:
|
|||
|
||||
|
||||
class ServicesSelectDialog(Dialog):
|
||||
def __init__(self, master, app: "Application", current_services: Set[str]):
|
||||
def __init__(self, master: Any, app: "Application", current_services: Set[str]):
|
||||
super().__init__(master, app, "Node Services", modal=True)
|
||||
self.groups = None
|
||||
self.services = None
|
||||
|
@ -100,7 +100,7 @@ class ServicesSelectDialog(Dialog):
|
|||
|
||||
|
||||
class CustomNodesDialog(Dialog):
|
||||
def __init__(self, master, app: "Application"):
|
||||
def __init__(self, master: "Application", app: "Application"):
|
||||
super().__init__(master, app, "Custom Nodes", modal=True)
|
||||
self.edit_button = None
|
||||
self.delete_button = None
|
||||
|
@ -245,7 +245,7 @@ class CustomNodesDialog(Dialog):
|
|||
self.nodes_list.listbox.selection_clear(0, tk.END)
|
||||
self.nodes_list.listbox.event_generate("<<ListboxSelect>>")
|
||||
|
||||
def handle_node_select(self, event):
|
||||
def handle_node_select(self, event: tk.Event):
|
||||
selection = self.nodes_list.listbox.curselection()
|
||||
if selection:
|
||||
self.selected_index = selection[0]
|
||||
|
|
|
@ -5,7 +5,7 @@ import logging
|
|||
import tkinter as tk
|
||||
import webbrowser
|
||||
from tkinter import ttk
|
||||
from typing import TYPE_CHECKING, Optional
|
||||
from typing import TYPE_CHECKING, Any, Optional
|
||||
|
||||
import grpc
|
||||
|
||||
|
@ -22,7 +22,7 @@ if TYPE_CHECKING:
|
|||
|
||||
|
||||
class GlobalEmaneDialog(Dialog):
|
||||
def __init__(self, master, app: "Application"):
|
||||
def __init__(self, master: Any, app: "Application"):
|
||||
super().__init__(master, app, "EMANE Configuration", modal=True)
|
||||
self.config_frame = None
|
||||
self.draw()
|
||||
|
@ -55,7 +55,7 @@ class GlobalEmaneDialog(Dialog):
|
|||
class EmaneModelDialog(Dialog):
|
||||
def __init__(
|
||||
self,
|
||||
master,
|
||||
master: Any,
|
||||
app: "Application",
|
||||
node: core_pb2.Node,
|
||||
model: str,
|
||||
|
@ -104,7 +104,9 @@ class EmaneModelDialog(Dialog):
|
|||
|
||||
|
||||
class EmaneConfigDialog(Dialog):
|
||||
def __init__(self, master, app: "Application", canvas_node: "CanvasNode"):
|
||||
def __init__(
|
||||
self, master: "Application", app: "Application", canvas_node: "CanvasNode"
|
||||
):
|
||||
super().__init__(
|
||||
master, app, f"{canvas_node.core_node.name} EMANE Configuration", modal=True
|
||||
)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import tkinter as tk
|
||||
from tkinter import ttk
|
||||
from typing import TYPE_CHECKING
|
||||
from typing import TYPE_CHECKING, Union
|
||||
|
||||
from core.api.grpc import core_pb2
|
||||
from core.gui.dialogs.dialog import Dialog
|
||||
|
@ -12,7 +12,7 @@ if TYPE_CHECKING:
|
|||
|
||||
|
||||
class HookDialog(Dialog):
|
||||
def __init__(self, master, app: "Application"):
|
||||
def __init__(self, master: Union[tk.Widget, Dialog], app: "Application"):
|
||||
super().__init__(master, app, "Hook", modal=True)
|
||||
self.name = tk.StringVar()
|
||||
self.codetext = None
|
||||
|
@ -88,7 +88,7 @@ class HookDialog(Dialog):
|
|||
|
||||
|
||||
class HooksDialog(Dialog):
|
||||
def __init__(self, master, app: "Application"):
|
||||
def __init__(self, master: "Application", app: "Application"):
|
||||
super().__init__(master, app, "Hooks", modal=True)
|
||||
self.listbox = None
|
||||
self.edit_button = None
|
||||
|
|
|
@ -13,7 +13,7 @@ from core.gui.themes import PADX, PADY
|
|||
|
||||
if TYPE_CHECKING:
|
||||
from core.gui.app import Application
|
||||
from core.gui.graph.edges import CanvasEdge
|
||||
from core.gui.graph.graph import CanvasGraph, CanvasEdge
|
||||
|
||||
|
||||
def get_int(var: tk.StringVar) -> Union[int, None]:
|
||||
|
@ -33,7 +33,7 @@ def get_float(var: tk.StringVar) -> Union[float, None]:
|
|||
|
||||
|
||||
class LinkConfigurationDialog(Dialog):
|
||||
def __init__(self, master, app: "Application", edge: "CanvasEdge"):
|
||||
def __init__(self, master: "CanvasGraph", app: "Application", edge: "CanvasEdge"):
|
||||
super().__init__(master, app, "Link Configuration", modal=True)
|
||||
self.app = app
|
||||
self.edge = edge
|
||||
|
|
|
@ -17,7 +17,10 @@ MARKER_THICKNESS = [3, 5, 8, 10]
|
|||
|
||||
class MarkerDialog(Dialog):
|
||||
def __init__(
|
||||
self, master, app: "Application", initcolor: Optional[str] = "#000000"
|
||||
self,
|
||||
master: "Application",
|
||||
app: "Application",
|
||||
initcolor: Optional[str] = "#000000",
|
||||
):
|
||||
super().__init__(master, app, "marker tool", modal=False)
|
||||
self.app = app
|
||||
|
|
|
@ -17,7 +17,9 @@ if TYPE_CHECKING:
|
|||
|
||||
|
||||
class MobilityConfigDialog(Dialog):
|
||||
def __init__(self, master, app: "Application", canvas_node: "CanvasNode"):
|
||||
def __init__(
|
||||
self, master: "Application", app: "Application", canvas_node: "CanvasNode"
|
||||
):
|
||||
super().__init__(
|
||||
master,
|
||||
app,
|
||||
|
|
|
@ -18,7 +18,13 @@ ICON_SIZE = 16
|
|||
|
||||
|
||||
class MobilityPlayer:
|
||||
def __init__(self, master, app: "Application", canvas_node: "CanvasNode", config):
|
||||
def __init__(
|
||||
self,
|
||||
master: "Application",
|
||||
app: "Application",
|
||||
canvas_node: "CanvasNode",
|
||||
config,
|
||||
):
|
||||
self.master = master
|
||||
self.app = app
|
||||
self.canvas_node = canvas_node
|
||||
|
@ -62,7 +68,9 @@ class MobilityPlayer:
|
|||
|
||||
|
||||
class MobilityPlayerDialog(Dialog):
|
||||
def __init__(self, master, app, canvas_node, config):
|
||||
def __init__(
|
||||
self, master: Dialog, app: "Application", canvas_node: "CanvasNode", config
|
||||
):
|
||||
super().__init__(
|
||||
master, app, f"{canvas_node.core_node.name} Mobility Player", modal=False
|
||||
)
|
||||
|
|
|
@ -18,7 +18,7 @@ if TYPE_CHECKING:
|
|||
from core.gui.graph.node import CanvasNode
|
||||
|
||||
|
||||
def mac_auto(is_auto, entry: ttk.Entry):
|
||||
def mac_auto(is_auto, entry):
|
||||
logging.info("mac auto clicked")
|
||||
if is_auto.get():
|
||||
logging.info("disabling mac")
|
||||
|
@ -38,13 +38,11 @@ class InterfaceData:
|
|||
|
||||
|
||||
class NodeConfigDialog(Dialog):
|
||||
def __init__(self, master, app: "Application", canvas_node: "CanvasNode"):
|
||||
def __init__(
|
||||
self, master: "Application", app: "Application", canvas_node: "CanvasNode"
|
||||
):
|
||||
"""
|
||||
create an instance of node configuration
|
||||
|
||||
:param master: dialog master
|
||||
:param coretk.app.Application: main app
|
||||
:param coretk.graph.CanvasNode canvas_node: canvas node object
|
||||
"""
|
||||
super().__init__(
|
||||
master, app, f"{canvas_node.core_node.name} Configuration", modal=True
|
||||
|
|
|
@ -3,7 +3,7 @@ core node services
|
|||
"""
|
||||
import tkinter as tk
|
||||
from tkinter import messagebox, ttk
|
||||
from typing import TYPE_CHECKING
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from core.gui.dialogs.dialog import Dialog
|
||||
from core.gui.dialogs.serviceconfig import ServiceConfigDialog
|
||||
|
@ -17,7 +17,7 @@ if TYPE_CHECKING:
|
|||
|
||||
class NodeServiceDialog(Dialog):
|
||||
def __init__(
|
||||
self, master, app: "Application", canvas_node: "CanvasNode", services=None
|
||||
self, master: Any, app: "Application", canvas_node: "CanvasNode", services=None
|
||||
):
|
||||
title = f"{canvas_node.core_node.name} Services"
|
||||
super().__init__(master, app, title, modal=True)
|
||||
|
|
|
@ -12,7 +12,7 @@ if TYPE_CHECKING:
|
|||
|
||||
|
||||
class ObserverDialog(Dialog):
|
||||
def __init__(self, master, app: "Application"):
|
||||
def __init__(self, master: "Application", app: "Application"):
|
||||
super().__init__(master, app, "Observer Widgets", modal=True)
|
||||
self.observers = None
|
||||
self.save_button = None
|
||||
|
|
|
@ -12,7 +12,7 @@ if TYPE_CHECKING:
|
|||
|
||||
|
||||
class PreferencesDialog(Dialog):
|
||||
def __init__(self, master, app: "Application"):
|
||||
def __init__(self, master: "Application", app: "Application"):
|
||||
super().__init__(master, app, "Preferences", modal=True)
|
||||
preferences = self.app.guiconfig["preferences"]
|
||||
self.editor = tk.StringVar(value=preferences["editor"])
|
||||
|
|
|
@ -16,7 +16,7 @@ DEFAULT_PORT = 50051
|
|||
|
||||
|
||||
class ServersDialog(Dialog):
|
||||
def __init__(self, master, app: "Application"):
|
||||
def __init__(self, master: "Application", app: "Application"):
|
||||
super().__init__(master, app, "CORE Servers", modal=True)
|
||||
self.name = tk.StringVar(value=DEFAULT_NAME)
|
||||
self.address = tk.StringVar(value=DEFAULT_ADDRESS)
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
"Service configuration dialog"
|
||||
"""
|
||||
Service configuration dialog
|
||||
"""
|
||||
import tkinter as tk
|
||||
from tkinter import ttk
|
||||
from typing import TYPE_CHECKING, List
|
||||
from typing import TYPE_CHECKING, Any, List
|
||||
|
||||
import grpc
|
||||
|
||||
|
@ -18,7 +20,9 @@ if TYPE_CHECKING:
|
|||
|
||||
|
||||
class ServiceConfigDialog(Dialog):
|
||||
def __init__(self, master, app: "Application", service_name: str, node_id: int):
|
||||
def __init__(
|
||||
self, master: Any, app: "Application", service_name: str, node_id: int
|
||||
):
|
||||
title = f"{service_name} Service"
|
||||
super().__init__(master, app, title, modal=True)
|
||||
self.master = master
|
||||
|
@ -229,7 +233,7 @@ class ServiceConfigDialog(Dialog):
|
|||
for i in range(3):
|
||||
tab.rowconfigure(i, weight=1)
|
||||
self.notebook.add(tab, text="Startup/Shutdown")
|
||||
|
||||
commands = []
|
||||
# tab 3
|
||||
for i in range(3):
|
||||
label_frame = None
|
||||
|
|
|
@ -14,7 +14,7 @@ if TYPE_CHECKING:
|
|||
|
||||
|
||||
class SessionOptionsDialog(Dialog):
|
||||
def __init__(self, master, app: "Application"):
|
||||
def __init__(self, master: "Application", app: "Application"):
|
||||
super().__init__(master, app, "Session Options", modal=True)
|
||||
self.config_frame = None
|
||||
self.config = self.get_config()
|
||||
|
|
|
@ -17,7 +17,7 @@ if TYPE_CHECKING:
|
|||
|
||||
|
||||
class SessionsDialog(Dialog):
|
||||
def __init__(self, master, app: "Application"):
|
||||
def __init__(self, master: "Application", app: "Application"):
|
||||
super().__init__(master, app, "Sessions", modal=True)
|
||||
self.selected = False
|
||||
self.selected_id = None
|
||||
|
|
|
@ -20,7 +20,7 @@ BORDER_WIDTH = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
|
|||
|
||||
|
||||
class ShapeDialog(Dialog):
|
||||
def __init__(self, master, app: "Application", shape: "Shape"):
|
||||
def __init__(self, master: "Application", app: "Application", shape: "Shape"):
|
||||
if is_draw_shape(shape.shape_type):
|
||||
title = "Add Shape"
|
||||
else:
|
||||
|
|
|
@ -14,7 +14,7 @@ if TYPE_CHECKING:
|
|||
|
||||
|
||||
class ThroughputDialog(Dialog):
|
||||
def __init__(self, master, app: "Application"):
|
||||
def __init__(self, master: "Application", app: "Application"):
|
||||
super().__init__(master, app, "Throughput Config", modal=False)
|
||||
self.app = app
|
||||
self.canvas = app.canvas
|
||||
|
|
|
@ -18,7 +18,9 @@ if TYPE_CHECKING:
|
|||
|
||||
|
||||
class WlanConfigDialog(Dialog):
|
||||
def __init__(self, master, app: "Application", canvas_node: "CanvasNode"):
|
||||
def __init__(
|
||||
self, master: "Application", app: "Application", canvas_node: "CanvasNode"
|
||||
):
|
||||
super().__init__(
|
||||
master, app, f"{canvas_node.core_node.name} Wlan Configuration", modal=True
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue