Grotti 3.1.0: Bedarf-UI, Zeitfenster, HT/NT, Theme, Chrome-Fixes.

Bedarf in Sidebar/Material, Drucker-Zeitfenster und Tarif in Einstellungen, helles Theme; Legacy-Token und /api/drucker entfernt; SSE/SW-Fixes gegen hängende Navigation in Chrome.
This commit is contained in:
Dominic Gundel committed 2026-10-18 02:20:12 +02:00
1 parent 8e88efc094
commit 6e59df22e5
23 files changed
+741 -171

No files matched your search

+7 -3
View File
@@ -15,7 +15,7 @@ def compute(conn):
queue_rows = conn.execute(
"""
SELECT q.id, q.spool_id, q.repeat_total, q.repeat_done,
f.weight_g, f.material_type AS file_material, f.color AS file_color,
f.weight_g, f.filaments,
s.material_type AS spool_material, s.color AS spool_color
FROM print_queue q
JOIN files f ON f.id = q.file_id
@@ -26,8 +26,12 @@ def compute(conn):
needed_map = {}
for row in queue_rows:
mat = (row.get("spool_material") or row.get("file_material") or "").strip()
color = (row.get("spool_color") or row.get("file_color") or "").strip()
filaments = row.get("filaments") or []
first = filaments[0] if isinstance(filaments, list) and filaments else {}
if not isinstance(first, dict):
first = {}
mat = (row.get("spool_material") or first.get("type") or "").strip()
color = (row.get("spool_color") or first.get("color") or "").strip()
key = _group_key(mat, color)
try:
repeats = max(1, int(row.get("repeat_total") or 1) - int(row.get("repeat_done") or 0))
+1 -1
View File
@@ -300,7 +300,7 @@ def _save_settings_locked(
"utilization": float(energy.get("utilization", 50)),
}
tariff_in = energy.get("tariff") if isinstance(energy.get("tariff"), dict) else None
if tariff_in is not None:
if tariff_in:
raw_energy["tariff"] = {
"ht_euro": float(tariff_in.get("ht_euro", raw_energy["euro_per_kwh"])),
"nt_euro": float(tariff_in.get("nt_euro", raw_energy["euro_per_kwh"])),
+11 -3
View File
@@ -2081,20 +2081,28 @@ def create_printer(conn, printer_id, name, host, family):
return printer_out(row)
def update_printer(conn, printer_id, name, host, family, locked=None):
def update_printer(conn, printer_id, name, host, family, locked=None, start_window=None):
current = printer_by_id(conn, printer_id)
if not current:
return None
if locked is None:
locked = bool(current.get("locked"))
if start_window is None:
sw = current.get("start_window") or {}
elif isinstance(start_window, dict):
sw = start_window
else:
sw = {}
if not isinstance(sw, dict):
sw = {}
row = conn.execute(
"""
UPDATE printers
SET name = %s, host = %s, family = %s, locked = %s
SET name = %s, host = %s, family = %s, locked = %s, start_window = %s
WHERE id = %s
RETURNING *
""",
(name, host, family, bool(locked), printer_id),
(name, host, family, bool(locked), Json(sw), printer_id),
).fetchone()
if current["host"] != host:
old = current["host"]
+1 -1
View File
@@ -1,3 +1,3 @@
"""Version von Grotti (SemVer). Bei jeder Änderung CHANGELOG.md mitführen."""
__version__ = "3.0.0"
__version__ = "3.1.0"