Alpha4 polish griglie e login
This commit is contained in:
@@ -11,6 +11,13 @@ from busy_overlay import InlineBusyOverlay
|
||||
from gestione_aree import AsyncRunner
|
||||
from locale_text import load_locale_catalog, text as loc_text
|
||||
from ui_theme import theme_color, theme_font, theme_section, theme_value
|
||||
from ui_tables import (
|
||||
apply_tksheet_visual_style,
|
||||
apply_tksheet_zebra,
|
||||
merge_tags,
|
||||
style_treeview,
|
||||
zebra_tag,
|
||||
)
|
||||
from version_info import module_version, versioned_title
|
||||
from window_placement import place_window_fullsize_below_parent_later
|
||||
from tooltips import WidgetToolTip, load_tooltip_catalog, tooltip_text
|
||||
@@ -177,17 +184,25 @@ class SearchWindow(ctk.CTkToplevel):
|
||||
self.use_sheet = False
|
||||
cols = ("IDCella", "Ubicazione", "UDC", "Lotto", "Codice", "Descrizione")
|
||||
self.tree = ttk.Treeview(wrap, columns=cols, show="headings")
|
||||
self._style = ttk.Style(self)
|
||||
try:
|
||||
self._style.theme_use(self._style.theme_use())
|
||||
except Exception:
|
||||
pass
|
||||
self._style.configure("Search.Treeview", rowheight=22, font=("", 9))
|
||||
self._style.configure("Search.Treeview.Heading", font=("", 9, "bold"), background="#F3F4F6")
|
||||
self._style.map("Search.Treeview", background=[("selected", "#DCEBFF")])
|
||||
self.tree.configure(style="Search.Treeview")
|
||||
self.tree.tag_configure("even", background="#FFFFFF")
|
||||
self.tree.tag_configure("odd", background="#F7F9FC")
|
||||
headings = {
|
||||
"IDCella": ("IDCella", 90, "e"),
|
||||
"Ubicazione": ("Ubicazione", 150, "w"),
|
||||
"UDC": ("UDC / Barcode", 130, "w"),
|
||||
"Lotto": ("Lotto", 130, "w"),
|
||||
"Codice": ("Codice prodotto", 150, "w"),
|
||||
"Descrizione": ("Descrizione prodotto", 340, "w"),
|
||||
}
|
||||
for col in cols:
|
||||
text, width, anchor = headings[col]
|
||||
self.tree.heading(col, text=text)
|
||||
self.tree.column(col, width=width, anchor=anchor, stretch=True)
|
||||
self._style = style_treeview(
|
||||
self.tree,
|
||||
style_name="Search.Treeview",
|
||||
rowheight=22,
|
||||
font=("", 9),
|
||||
heading_font=("", 9, "bold"),
|
||||
)
|
||||
self.tree.tag_configure("id9999", background="#FFECEC", foreground="#B00020")
|
||||
|
||||
sy = ttk.Scrollbar(wrap, orient="vertical", command=self.tree.yview)
|
||||
@@ -212,7 +227,7 @@ class SearchWindow(ctk.CTkToplevel):
|
||||
is9999 = int(vals[0]) == 9999
|
||||
except Exception:
|
||||
is9999 = False
|
||||
tags = ("id9999", zebra) if is9999 else (zebra,)
|
||||
tags = merge_tags(zebra, "id9999" if is9999 else "")
|
||||
self.tree.item(iid, tags=tags)
|
||||
|
||||
def _export_xlsx(self):
|
||||
@@ -417,6 +432,8 @@ class SearchWindow(ctk.CTkToplevel):
|
||||
hdrs = list(headers)
|
||||
hdrs[c] = hdrs[c] + arrow
|
||||
self.sheet.headers(hdrs)
|
||||
apply_tksheet_visual_style(self.sheet)
|
||||
apply_tksheet_zebra(self.sheet, len(data))
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
@@ -452,7 +469,10 @@ class SearchWindow(ctk.CTkToplevel):
|
||||
for row in rows:
|
||||
idc, ubi, udc_v, lot_v, cod_v, desc_v = row
|
||||
data.append([idc, ubi, udc_v, lot_v, cod_v, desc_v])
|
||||
self.sheet.headers(["IDCella", "Ubicazione", "UDC", "Lotto", "Codice", "Descrizione"])
|
||||
apply_tksheet_visual_style(self.sheet)
|
||||
self.sheet.set_sheet_data(data)
|
||||
apply_tksheet_zebra(self.sheet, len(data))
|
||||
self.sheet.set_all_cell_sizes_to_text()
|
||||
except Exception:
|
||||
self.use_sheet = False
|
||||
@@ -461,12 +481,11 @@ class SearchWindow(ctk.CTkToplevel):
|
||||
self.tree.delete(iid)
|
||||
for idx, row in enumerate(rows):
|
||||
idc, ubi, udc_v, lot_v, cod_v, desc_v = row
|
||||
zebra = "even" if idx % 2 == 0 else "odd"
|
||||
try:
|
||||
is9999 = int(idc) == 9999
|
||||
except Exception:
|
||||
is9999 = False
|
||||
tags = ("id9999", zebra) if is9999 else (zebra,)
|
||||
tags = merge_tags(zebra_tag(idx), "id9999" if is9999 else "")
|
||||
self.tree.insert("", "end", values=(idc, ubi, udc_v, lot_v, cod_v, desc_v), tags=tags)
|
||||
|
||||
if not rows:
|
||||
|
||||
Reference in New Issue
Block a user