Stabilizza picking barcode e patch cumulativa online
This commit is contained in:
@@ -328,6 +328,8 @@ DET_COLS: List[ColSpec] = [
|
||||
]
|
||||
|
||||
ROW_H = 28
|
||||
RESERVED_IDSTATO_BG = "#dc2626"
|
||||
RESERVED_IDSTATO_FG = "#ffffff"
|
||||
|
||||
|
||||
# -------------------- Micro spinner (toolbar) --------------------
|
||||
@@ -559,6 +561,8 @@ class ScrollTable(ctk.CTkFrame):
|
||||
row_index: int,
|
||||
anchors: Optional[List[str]] = None,
|
||||
checkbox_builder: Optional[Callable[[tk.Widget], ctk.CTkCheckBox]] = None,
|
||||
cell_bg: Optional[Dict[str, str]] = None,
|
||||
cell_fg: Optional[Dict[str, str]] = None,
|
||||
):
|
||||
"""Append one row to the table body."""
|
||||
row_bg = TABLE_ROW_EVEN if row_index % 2 == 0 else TABLE_ROW_ODD
|
||||
@@ -568,8 +572,9 @@ class ScrollTable(ctk.CTkFrame):
|
||||
row.pack_propagate(False)
|
||||
|
||||
for i, col in enumerate(self.columns):
|
||||
holder_bg = (cell_bg or {}).get(col.key, row_bg)
|
||||
holder = ctk.CTkFrame(
|
||||
row, fg_color=row_bg,
|
||||
row, fg_color=holder_bg,
|
||||
width=col.width, height=ROW_H,
|
||||
border_width=1, border_color=self.GRID_COLOR
|
||||
)
|
||||
@@ -581,10 +586,17 @@ class ScrollTable(ctk.CTkFrame):
|
||||
cb = checkbox_builder(holder)
|
||||
cb.pack(padx=(self.PADX_L, self.PADX_R), pady=self.PADY, anchor="w")
|
||||
else:
|
||||
ctk.CTkLabel(holder, text="", fg_color=row_bg).pack(fill="both")
|
||||
ctk.CTkLabel(holder, text="", fg_color=holder_bg).pack(fill="both")
|
||||
else:
|
||||
anchor = (anchors[i] if anchors else col.anchor)
|
||||
ctk.CTkLabel(holder, text=values[i], anchor=anchor, fg_color=row_bg, text_color="#111827").pack(
|
||||
ctk.CTkLabel(
|
||||
holder,
|
||||
text=values[i],
|
||||
anchor=anchor,
|
||||
fg_color=holder_bg,
|
||||
text_color=(cell_fg or {}).get(col.key, "#111827"),
|
||||
font=("Segoe UI", 10, "bold") if col.key == "IDStato" and col.key in (cell_bg or {}) else None,
|
||||
).pack(
|
||||
fill="both", padx=(self.PADX_L, self.PADX_R), pady=self.PADY
|
||||
)
|
||||
|
||||
@@ -876,10 +888,22 @@ class GestionePickingListFrame(ctk.CTkFrame):
|
||||
try:
|
||||
for idx, d in enumerate(rows):
|
||||
row_widget = self.pl_table.b_inner.winfo_children()[idx]
|
||||
if int(d.get("IDStato") or 0) == 1:
|
||||
row_widget.configure(fg_color="#ffe6f2") # rosa tenue
|
||||
else:
|
||||
row_widget.configure(fg_color="transparent")
|
||||
row_bg = TABLE_ROW_EVEN if idx % 2 == 0 else TABLE_ROW_ODD
|
||||
row_widget.configure(fg_color=row_bg)
|
||||
row_children = row_widget.winfo_children()
|
||||
if len(row_children) >= 5:
|
||||
holder = row_children[4]
|
||||
is_reserved = int(d.get("IDStato") or 0) == 1
|
||||
holder_bg = RESERVED_IDSTATO_BG if is_reserved else row_bg
|
||||
holder.configure(fg_color=holder_bg)
|
||||
if holder.winfo_children():
|
||||
lbl = holder.winfo_children()[0]
|
||||
if hasattr(lbl, "configure"):
|
||||
lbl.configure(
|
||||
fg_color=holder_bg,
|
||||
text_color=RESERVED_IDSTATO_FG if is_reserved else "#111827",
|
||||
font=("Segoe UI", 10, "bold") if is_reserved else ("Segoe UI", 10),
|
||||
)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
@@ -906,7 +930,9 @@ class GestionePickingListFrame(ctk.CTkFrame):
|
||||
values=values,
|
||||
row_index=r,
|
||||
anchors=[c.anchor for c in PL_COLS],
|
||||
checkbox_builder=model.build_checkbox
|
||||
checkbox_builder=model.build_checkbox,
|
||||
cell_bg={"IDStato": RESERVED_IDSTATO_BG} if int(d.get("IDStato") or 0) == 1 else None,
|
||||
cell_fg={"IDStato": RESERVED_IDSTATO_FG} if int(d.get("IDStato") or 0) == 1 else None,
|
||||
)
|
||||
|
||||
# 🎯 Colora dopo che la UI è resa → no balzi visivi
|
||||
@@ -932,10 +958,20 @@ class GestionePickingListFrame(ctk.CTkFrame):
|
||||
row_children = row_widget.winfo_children()
|
||||
if len(row_children) >= 5:
|
||||
holder = row_children[4]
|
||||
holder.configure(fg_color=RESERVED_IDSTATO_BG if idstato == 1 else (
|
||||
TABLE_ROW_EVEN if idx % 2 == 0 else TABLE_ROW_ODD
|
||||
))
|
||||
if holder.winfo_children():
|
||||
lbl = holder.winfo_children()[0]
|
||||
if hasattr(lbl, "configure"):
|
||||
lbl.configure(text=str(idstato))
|
||||
lbl.configure(
|
||||
text=str(idstato),
|
||||
fg_color=RESERVED_IDSTATO_BG if idstato == 1 else (
|
||||
TABLE_ROW_EVEN if idx % 2 == 0 else TABLE_ROW_ODD
|
||||
),
|
||||
text_color=RESERVED_IDSTATO_FG if idstato == 1 else "#111827",
|
||||
font=("Segoe UI", 10, "bold") if idstato == 1 else ("Segoe UI", 10),
|
||||
)
|
||||
except Exception:
|
||||
pass
|
||||
# differisci la colorazione (smooth)
|
||||
|
||||
Reference in New Issue
Block a user