pygui: added support for a details pane, can be toggled on/off, can be used to quickly view details for nodes or links
This commit is contained in:
parent
bb2ceaf993
commit
f582306bb9
12 changed files with 226 additions and 17 deletions
36
daemon/core/gui/frames/base.py
Normal file
36
daemon/core/gui/frames/base.py
Normal file
|
@ -0,0 +1,36 @@
|
|||
import tkinter as tk
|
||||
from tkinter import ttk
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from core.gui.themes import FRAME_PAD, PADX, PADY
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from core.gui.app import Application
|
||||
|
||||
|
||||
class InfoFrameBase(ttk.Frame):
|
||||
def __init__(self, master: tk.BaseWidget, app: "Application") -> None:
|
||||
super().__init__(master, padding=FRAME_PAD)
|
||||
self.app: "Application" = app
|
||||
|
||||
def draw(self) -> None:
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
class DetailsFrame(ttk.Frame):
|
||||
def __init__(self, master: tk.BaseWidget) -> None:
|
||||
super().__init__(master)
|
||||
self.columnconfigure(1, weight=1)
|
||||
self.row = 0
|
||||
|
||||
def add_detail(self, label: str, value: str) -> None:
|
||||
label = ttk.Label(self, text=label, anchor=tk.W)
|
||||
label.grid(row=self.row, sticky=tk.EW, column=0, padx=PADX)
|
||||
label = ttk.Label(self, text=value, anchor=tk.W, state=tk.DISABLED)
|
||||
label.grid(row=self.row, sticky=tk.EW, column=1)
|
||||
self.row += 1
|
||||
|
||||
def add_separator(self) -> None:
|
||||
separator = ttk.Separator(self)
|
||||
separator.grid(row=self.row, sticky=tk.EW, columnspan=2, pady=PADY)
|
||||
self.row += 1
|
Loading…
Add table
Add a link
Reference in a new issue