Milestone ultima alpha

This commit is contained in:
2026-05-22 14:25:09 +02:00
parent 8489cd7459
commit a5e704c214
25 changed files with 3896 additions and 273 deletions

View File

@@ -19,6 +19,7 @@ from openpyxl.styles import Alignment, Font
from busy_overlay import InlineBusyOverlay
from gestione_aree import AsyncRunner
from gestione_scarico import move_pallet_async
from locale_text import load_locale_catalog, text as loc_text
from tooltips import WidgetToolTip, load_tooltip_catalog, tooltip_text
from ui_theme import theme_color, theme_font, theme_section, theme_value
from window_placement import place_window_fullsize_below_parent_later
@@ -433,8 +434,9 @@ class CelleMultipleWindow(ctk.CTkToplevel):
"""Bind the shared DB client and immediately load the tree summary."""
super().__init__(root)
self._theme = theme_section("multi_udc", {})
self._locale_catalog = load_locale_catalog()
self._tooltip_catalog = load_tooltip_catalog()
self.title("Celle con piu' pallet")
self.title(loc_text("multi.title", catalog=self._locale_catalog, default="Celle con piu' pallet"))
self.session = session
self.geometry(str(theme_value(self._theme, "window_geometry", "1100x700")))
minsize = theme_value(self._theme, "window_minsize", [900, 550])
@@ -469,17 +471,17 @@ class CelleMultipleWindow(ctk.CTkToplevel):
toolbar.configure(fg_color=theme_color(self._theme, "toolbar_frame_fg_color", ("#d7d7d7", "#3b3b3b")))
except Exception:
pass
btn_refresh = ctk.CTkButton(toolbar, text="Aggiorna", command=self.refresh_all, font=theme_font(self._theme, "toolbar_button_font", ("Segoe UI", 10, "bold")))
btn_refresh = ctk.CTkButton(toolbar, text=loc_text("multi.button.refresh", catalog=self._locale_catalog, default="Aggiorna"), command=self.refresh_all, font=theme_font(self._theme, "toolbar_button_font", ("Segoe UI", 10, "bold")))
btn_refresh.pack(side="left", padx=6, pady=4)
btn_expand = ctk.CTkButton(toolbar, text="Espandi tutto", command=self.expand_all, font=theme_font(self._theme, "toolbar_button_font", ("Segoe UI", 10, "bold")))
btn_expand = ctk.CTkButton(toolbar, text=loc_text("multi.button.expand", catalog=self._locale_catalog, default="Espandi tutto"), command=self.expand_all, font=theme_font(self._theme, "toolbar_button_font", ("Segoe UI", 10, "bold")))
btn_expand.pack(side="left", padx=6, pady=4)
btn_collapse = ctk.CTkButton(toolbar, text="Comprimi tutto", command=self.collapse_all, font=theme_font(self._theme, "toolbar_button_font", ("Segoe UI", 10, "bold")))
btn_collapse = ctk.CTkButton(toolbar, text=loc_text("multi.button.collapse", catalog=self._locale_catalog, default="Comprimi tutto"), command=self.collapse_all, font=theme_font(self._theme, "toolbar_button_font", ("Segoe UI", 10, "bold")))
btn_collapse.pack(side="left", padx=6, pady=4)
btn_preselect = ctk.CTkButton(toolbar, text="Preselezione fantasmi corsia", command=self._preselect_selected_corsia, font=theme_font(self._theme, "toolbar_button_font", ("Segoe UI", 10, "bold")))
btn_preselect = ctk.CTkButton(toolbar, text=loc_text("multi.button.preselect", catalog=self._locale_catalog, default="Preselezione fantasmi corsia"), command=self._preselect_selected_corsia, font=theme_font(self._theme, "toolbar_button_font", ("Segoe UI", 10, "bold")))
btn_preselect.pack(side="left", padx=6, pady=4)
btn_remove = ctk.CTkButton(toolbar, text="Rimuovi fantasmi corsia", command=self._remove_selected_ghosts_for_corsia, font=theme_font(self._theme, "toolbar_button_font", ("Segoe UI", 10, "bold")))
btn_remove = ctk.CTkButton(toolbar, text=loc_text("multi.button.remove", catalog=self._locale_catalog, default="Rimuovi fantasmi corsia"), command=self._remove_selected_ghosts_for_corsia, font=theme_font(self._theme, "toolbar_button_font", ("Segoe UI", 10, "bold")))
btn_remove.pack(side="left", padx=6, pady=4)
btn_export = ctk.CTkButton(toolbar, text="Esporta in XLSX", command=self.export_to_xlsx, font=theme_font(self._theme, "toolbar_button_font", ("Segoe UI", 10, "bold")))
btn_export = ctk.CTkButton(toolbar, text=loc_text("multi.button.export", catalog=self._locale_catalog, default="Esporta in XLSX"), command=self.export_to_xlsx, font=theme_font(self._theme, "toolbar_button_font", ("Segoe UI", 10, "bold")))
btn_export.pack(side="left", padx=6, pady=4)
WidgetToolTip(btn_refresh, tooltip_text("multi_udc.refresh", catalog=self._tooltip_catalog))
WidgetToolTip(btn_expand, tooltip_text("multi_udc.expand_all", catalog=self._tooltip_catalog))
@@ -520,7 +522,7 @@ class CelleMultipleWindow(ctk.CTkToplevel):
pass
ctk.CTkLabel(
sumf,
text="Riepilogo % celle multiple per corsia",
text=loc_text("multi.summary", catalog=self._locale_catalog, default="Riepilogo % celle multiple per corsia"),
font=theme_font(self._theme, "summary_title_font", ("Segoe UI", 12, "bold")),
).pack(anchor="w", padx=8, pady=(8, 0))
inner = ctk.CTkFrame(sumf)
@@ -645,7 +647,13 @@ class CelleMultipleWindow(ctk.CTkToplevel):
_MODULE_LOGGER.exception(f"Errore caricamento corsie UDC fantasma: {ex}")
messagebox.showerror("Errore", str(ex), parent=self)
self.runner.run(_q(self.db), self._fill_corsie, _err)
self.runner.run(
_q(self.db),
self._fill_corsie,
_err,
busy=self._busy,
message="Carico corsie UDC fantasma...",
)
@_log_call()
def _fill_corsie(self, res):
@@ -700,7 +708,13 @@ class CelleMultipleWindow(ctk.CTkToplevel):
_MODULE_LOGGER.exception(f"Errore caricamento celle duplicate corsia={corsia}: {ex}")
messagebox.showerror("Errore", str(ex), parent=self)
self.runner.run(_q(self.db), lambda res: self._fill_celle(parent_iid, res), _err)
self.runner.run(
_q(self.db),
lambda res: self._fill_celle(parent_iid, res),
_err,
busy=self._busy,
message=f"Carico celle duplicate corsia {corsia}...",
)
@_log_call()
def _fill_celle(self, parent_iid, res):
@@ -744,7 +758,13 @@ class CelleMultipleWindow(ctk.CTkToplevel):
_MODULE_LOGGER.exception(f"Errore caricamento pallet cella idcella={idcella}: {ex}")
messagebox.showerror("Errore", str(ex), parent=self)
self.runner.run(_q(self.db), lambda res: self._fill_pallet(parent_iid, res), _err)
self.runner.run(
_q(self.db),
lambda res: self._fill_pallet(parent_iid, res),
_err,
busy=self._busy,
message=f"Carico pallet della cella {idcella}...",
)
@_log_call()
def _fill_pallet(self, parent_iid, res):
@@ -859,7 +879,13 @@ class CelleMultipleWindow(ctk.CTkToplevel):
_MODULE_LOGGER.exception(f"Errore preselezione fantasmi corsia={corsia}: {ex}")
messagebox.showerror("Errore", str(ex), parent=self)
self.runner.run(_q(self.db), _ok, _err)
self.runner.run(
_q(self.db),
_ok,
_err,
busy=self._busy,
message=f"Preselezione fantasmi corsia {corsia.strip()}...",
)
@_log_call()
def _remove_selected_ghosts_for_corsia(self):
@@ -926,7 +952,13 @@ class CelleMultipleWindow(ctk.CTkToplevel):
_MODULE_LOGGER.exception(f"Errore bonifica fantasmi corsia={corsia}: {ex}")
messagebox.showerror("Errore bonifica", str(ex), parent=self)
self.runner.run(_q(self.db), _ok, _err)
self.runner.run(
_q(self.db),
_ok,
_err,
busy=self._busy,
message=f"Rimozione fantasmi corsia {corsia.strip()}...",
)
@_log_call()
def _load_riepilogo(self):
@@ -940,7 +972,13 @@ class CelleMultipleWindow(ctk.CTkToplevel):
_MODULE_LOGGER.exception(f"Errore caricamento riepilogo UDC fantasma: {ex}")
messagebox.showerror("Errore", str(ex), parent=self)
self.runner.run(_q(self.db), self._fill_riepilogo, _err)
self.runner.run(
_q(self.db),
self._fill_riepilogo,
_err,
busy=self._busy,
message="Carico riepilogo UDC fantasma...",
)
@_log_call()
def _fill_riepilogo(self, res):