added automatic minsize of UI to prevent hidden Elements at startup
This commit is contained in:
13
src/gui.py
13
src/gui.py
@@ -55,7 +55,6 @@ class DHCPApp(tk.Frame):
|
||||
def __init__(self, master: tk.Tk) -> None:
|
||||
super().__init__(master)
|
||||
master.title("Simple DHCP Server (Lab)")
|
||||
master.minsize(700, 500)
|
||||
self.pack(fill="both", expand=True, padx=12, pady=12)
|
||||
|
||||
# Single server instance
|
||||
@@ -111,13 +110,13 @@ class DHCPApp(tk.Frame):
|
||||
left = ttk.Labelframe(paned, text="Aktive Clients / Leases")
|
||||
self.clients = tk.Listbox(left, height=12)
|
||||
self.clients.pack(fill="both", expand=True, padx=6, pady=6)
|
||||
paned.add(left, weight=1)
|
||||
paned.add(left, weight=1, minsize=240)
|
||||
|
||||
# Logs
|
||||
right = ttk.Labelframe(paned, text="Log")
|
||||
self.log = tk.Text(right, height=12, state="disabled")
|
||||
self.log.pack(fill="both", expand=True, padx=6, pady=6)
|
||||
paned.add(right, weight=2)
|
||||
paned.add(right, weight=2, minsize=360)
|
||||
|
||||
# --- Status bar ---
|
||||
self.status_var = tk.StringVar(value="Bereit.")
|
||||
@@ -125,6 +124,7 @@ class DHCPApp(tk.Frame):
|
||||
status.pack(fill="x", side="bottom")
|
||||
|
||||
self._refresh_interface_list(initial=True)
|
||||
self._apply_min_sizes()
|
||||
|
||||
# periodic refresh
|
||||
self.after(400, self._refresh)
|
||||
@@ -192,6 +192,13 @@ class DHCPApp(tk.Frame):
|
||||
if not initial:
|
||||
self.status_var.set("Keine Netzwerk-Interfaces gefunden.")
|
||||
|
||||
def _apply_min_sizes(self) -> None:
|
||||
# Ensure window cannot shrink below a comfortable layout
|
||||
self.update_idletasks()
|
||||
min_w = max(self.winfo_reqwidth() + 16, 720)
|
||||
min_h = max(self.winfo_reqheight() + 16, 540)
|
||||
self.master.minsize(min_w, min_h)
|
||||
|
||||
def rescan_interfaces(self) -> None:
|
||||
if self.server and self.server.is_running():
|
||||
messagebox.showinfo("Server läuft", "Stoppe den Server, bevor du Interfaces neu scannst.")
|
||||
|
||||
Reference in New Issue
Block a user