Checkpoint before more window sizing work
This commit is contained in:
@@ -18,10 +18,14 @@ from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from audit_log import log_user_action
|
||||
from gestione_aree import BusyOverlay, AsyncRunner
|
||||
from busy_overlay import InlineBusyOverlay
|
||||
from gestione_aree import AsyncRunner
|
||||
from gestione_scarico import DEFAULT_SCARICO_USER, move_pallet_async, open_scarico_dialog
|
||||
from tksheet import Sheet, natural_sort_key
|
||||
from tooltips import WidgetToolTip, load_tooltip_catalog, tooltip_text
|
||||
from ui_theme import theme_color, theme_font, theme_section, theme_value
|
||||
from user_session import UserSession
|
||||
from window_placement import place_window_fullsize_below_parent_later
|
||||
|
||||
try:
|
||||
from loguru import logger
|
||||
@@ -204,14 +208,21 @@ class LayoutWindow(ctk.CTkToplevel):
|
||||
def __init__(self, parent: tk.Widget, db_app, session: UserSession | None = None):
|
||||
"""Create the window and initialize the state used by the matrix view."""
|
||||
super().__init__(parent)
|
||||
self._theme = theme_section("layout_window", {})
|
||||
self._tooltip_catalog = load_tooltip_catalog()
|
||||
self.title("Warehouse - Layout corsie")
|
||||
self.geometry("1200x740")
|
||||
self.minsize(980, 560)
|
||||
self.geometry(str(theme_value(self._theme, "window_geometry", "1200x740")))
|
||||
minsize = theme_value(self._theme, "window_minsize", [980, 560])
|
||||
self.minsize(int(minsize[0]), int(minsize[1]))
|
||||
self.resizable(True, True)
|
||||
try:
|
||||
self.configure(fg_color=theme_color(self._theme, "window_fg_color", ("#efefef", "#2f2f2f")))
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
self.db = db_app
|
||||
self.session = session
|
||||
self._busy = BusyOverlay(self)
|
||||
self._busy = InlineBusyOverlay(self, self._theme)
|
||||
self._async = AsyncRunner(self)
|
||||
|
||||
# layout principale 5% / 80% / 15%
|
||||
@@ -254,6 +265,10 @@ class LayoutWindow(ctk.CTkToplevel):
|
||||
"""Create the top toolbar with aisle selection and search controls."""
|
||||
top = ctk.CTkFrame(self)
|
||||
top.grid(row=0, column=0, sticky="nsew", padx=8, pady=6)
|
||||
try:
|
||||
top.configure(fg_color=theme_color(self._theme, "top_frame_fg_color", ("#d7d7d7", "#3b3b3b")))
|
||||
except Exception:
|
||||
pass
|
||||
for i in range(4):
|
||||
top.grid_columnconfigure(i, weight=0)
|
||||
top.grid_columnconfigure(1, weight=1)
|
||||
@@ -261,8 +276,16 @@ class LayoutWindow(ctk.CTkToplevel):
|
||||
# lista corsie
|
||||
lf = ctk.CTkFrame(top)
|
||||
lf.grid(row=0, column=0, sticky="nsw")
|
||||
try:
|
||||
lf.configure(fg_color=theme_color(self._theme, "panel_frame_fg_color", ("#dcdcdc", "#363636")))
|
||||
except Exception:
|
||||
pass
|
||||
lf.grid_columnconfigure(0, weight=1)
|
||||
ctk.CTkLabel(lf, text="Corsie", font=("", 12, "bold")).grid(row=0, column=0, sticky="w", padx=6, pady=(6, 2))
|
||||
ctk.CTkLabel(
|
||||
lf,
|
||||
text="Corsie",
|
||||
font=theme_font(self._theme, "toolbar_label_font", ("Segoe UI", 12, "bold")),
|
||||
).grid(row=0, column=0, sticky="w", padx=6, pady=(6, 2))
|
||||
self.lb = tk.Listbox(lf, height=6, exportselection=False)
|
||||
self.lb.grid(row=1, column=0, sticky="nsw", padx=6, pady=(0, 6))
|
||||
self.lb.bind("<<ListboxSelect>>", self._on_select)
|
||||
@@ -271,16 +294,50 @@ class LayoutWindow(ctk.CTkToplevel):
|
||||
srch = ctk.CTkFrame(top)
|
||||
srch.grid(row=0, column=1, sticky="nsew", padx=(10, 10))
|
||||
self.search_var = tk.StringVar()
|
||||
self.search_entry = ctk.CTkEntry(srch, textvariable=self.search_var, width=260)
|
||||
try:
|
||||
srch.configure(fg_color=theme_color(self._theme, "panel_frame_fg_color", ("#dcdcdc", "#363636")))
|
||||
except Exception:
|
||||
pass
|
||||
self.search_entry = ctk.CTkEntry(
|
||||
srch,
|
||||
textvariable=self.search_var,
|
||||
width=260,
|
||||
font=theme_font(self._theme, "entry_font", ("Segoe UI", 10)),
|
||||
)
|
||||
self.search_entry.grid(row=0, column=0, sticky="w")
|
||||
ctk.CTkButton(srch, text="Cerca per barcode UDC", command=self._search_udc).grid(row=0, column=1, padx=(8, 0))
|
||||
btn_search = ctk.CTkButton(
|
||||
srch,
|
||||
text="Cerca per barcode UDC",
|
||||
command=self._search_udc,
|
||||
font=theme_font(self._theme, "toolbar_button_font", ("Segoe UI", 10, "bold")),
|
||||
)
|
||||
btn_search.grid(row=0, column=1, padx=(8, 0))
|
||||
srch.grid_columnconfigure(0, weight=1)
|
||||
WidgetToolTip(btn_search, tooltip_text("layout.search_udc", catalog=self._tooltip_catalog))
|
||||
|
||||
# toolbar
|
||||
tb = ctk.CTkFrame(top)
|
||||
tb.grid(row=0, column=3, sticky="ne")
|
||||
ctk.CTkButton(tb, text="Aggiorna", command=self._refresh_current).grid(row=0, column=0, padx=4)
|
||||
ctk.CTkButton(tb, text="Export XLSX", command=self._export_xlsx).grid(row=0, column=1, padx=4)
|
||||
try:
|
||||
tb.configure(fg_color=theme_color(self._theme, "panel_frame_fg_color", ("#dcdcdc", "#363636")))
|
||||
except Exception:
|
||||
pass
|
||||
btn_refresh = ctk.CTkButton(
|
||||
tb,
|
||||
text="Aggiorna",
|
||||
command=self._refresh_current,
|
||||
font=theme_font(self._theme, "toolbar_button_font", ("Segoe UI", 10, "bold")),
|
||||
)
|
||||
btn_refresh.grid(row=0, column=0, padx=4)
|
||||
btn_export = ctk.CTkButton(
|
||||
tb,
|
||||
text="Export XLSX",
|
||||
command=self._export_xlsx,
|
||||
font=theme_font(self._theme, "toolbar_button_font", ("Segoe UI", 10, "bold")),
|
||||
)
|
||||
btn_export.grid(row=0, column=1, padx=4)
|
||||
WidgetToolTip(btn_refresh, tooltip_text("layout.refresh", catalog=self._tooltip_catalog))
|
||||
WidgetToolTip(btn_export, tooltip_text("layout.export_xlsx", catalog=self._tooltip_catalog))
|
||||
|
||||
# ---------------- MATRIX HOST ----------------
|
||||
def _build_matrix_host(self):
|
||||
@@ -1361,6 +1418,10 @@ def open_layout_window(parent, db_app, session: UserSession | None = None):
|
||||
ex = getattr(parent, key, None)
|
||||
if ex and ex.winfo_exists():
|
||||
ex.session = session
|
||||
try:
|
||||
ex.deiconify()
|
||||
except Exception:
|
||||
pass
|
||||
try:
|
||||
ex.lift()
|
||||
ex.focus_force()
|
||||
@@ -1369,4 +1430,5 @@ def open_layout_window(parent, db_app, session: UserSession | None = None):
|
||||
pass
|
||||
w = LayoutWindow(parent, db_app, session=session)
|
||||
setattr(parent, key, w)
|
||||
place_window_fullsize_below_parent_later(parent, w)
|
||||
return w
|
||||
|
||||
Reference in New Issue
Block a user