Grotti 3.3.0: Projekte mit Ordner, Datei-Löschen/Verschieben, Material-Archiv, UI-Polish.
This commit is contained in:
1 parent
4ddffbbeb1
commit
67a89d1794
45 files changed
+2856
-320
No files matched your search
+53
-13
@@ -57,25 +57,47 @@ def unix_to_dt(value):
|
||||
|
||||
def choose_spool(conn, host, material, hinted_id, ended_at=None):
|
||||
"""Spule für History-Abzug. Ohne Hint nur Rollen, die vor Druckende existierten."""
|
||||
at_host = [
|
||||
row for row in store.spools_for_printer(conn, host)
|
||||
if _spool_valid_for_end(row, ended_at)
|
||||
]
|
||||
if hinted_id:
|
||||
row = store.get_spool_row(conn, hinted_id)
|
||||
if row and not _spool_valid_for_end(row, ended_at):
|
||||
return None
|
||||
# Hint nur nutzen, wenn die Rolle noch am Drucker liegt — sonst Rollenwechsel
|
||||
if row and (row.get("printer_host") or "") == (host or ""):
|
||||
return row
|
||||
if row and not at_host:
|
||||
# Rolle schon im Regal, kein Nachfolger am Host → Hint behalten (alte Jobs)
|
||||
return row
|
||||
if len(at_host) == 1:
|
||||
return at_host[0]
|
||||
if material:
|
||||
same = [row for row in at_host if (row["material_type"] or "").lower() == material.lower()]
|
||||
if len(same) == 1:
|
||||
return same[0]
|
||||
if hinted_id:
|
||||
row = store.get_spool_row(conn, hinted_id)
|
||||
if row and _spool_valid_for_end(row, ended_at):
|
||||
return row
|
||||
if row and not _spool_valid_for_end(row, ended_at):
|
||||
return None
|
||||
rows = [
|
||||
row for row in store.spools_for_printer(conn, host)
|
||||
if _spool_valid_for_end(row, ended_at)
|
||||
]
|
||||
if len(rows) == 1:
|
||||
return rows[0]
|
||||
if material:
|
||||
same = [row for row in rows if (row["material_type"] or "").lower() == material.lower()]
|
||||
if len(same) == 1:
|
||||
return same[0]
|
||||
return None
|
||||
|
||||
|
||||
def resolve_tracking_spool(conn, host, hinted_id, ace_map=None):
|
||||
"""Spule für Live-Tracking: am Host liegende Rolle schlägt veralteten Send-Hint."""
|
||||
current = resolve_spools_at_host(conn, host, ace_map=ace_map)
|
||||
if len(current) == 1:
|
||||
return current[0]["id"]
|
||||
if hinted_id:
|
||||
row = store.get_spool_row(conn, hinted_id)
|
||||
if row and (row.get("printer_host") or "") == (host or ""):
|
||||
return hinted_id
|
||||
if current:
|
||||
return current[0]["id"]
|
||||
return hinted_id
|
||||
|
||||
|
||||
def _spool_valid_for_end(spool, ended_at):
|
||||
"""Verhindert Abzug alter Moonraker-Jobs auf neu eingelegte Spulen."""
|
||||
if ended_at is None or not spool:
|
||||
@@ -544,12 +566,30 @@ def send_file(
|
||||
)
|
||||
# CJK/Unicode im Namen → Rinkhals 10115 not found (Upload ≠ Start-Name)
|
||||
filename = moonraker.safe_upload_name(filename)
|
||||
ace_tools = [item.get("paint_index") for item in mapping] if mapping else None
|
||||
if (row.get("kind") or "") == "gcode" and str(filename).endswith(".gcode"):
|
||||
if slots and mapping:
|
||||
# Immer an G-code-Tn ausrichten (auch wenn UI fälschlich 0/1 schickt)
|
||||
content, mapping, filaments, remap = acm.align_tools_for_ace(
|
||||
content, mapping, filaments
|
||||
)
|
||||
if remap:
|
||||
progress(
|
||||
"ace",
|
||||
32,
|
||||
"Slicer-T verdichtet (%s)…"
|
||||
% ", ".join("T%s→T%s" % pair for pair in sorted(remap.items())),
|
||||
)
|
||||
ace_tools = [item.get("paint_index") for item in mapping] if mapping else None
|
||||
content = prepare_rinkhals_gcode(content, tools=ace_tools)
|
||||
if keep_motors:
|
||||
# Slice-Ende `M84` → sofort unhomed; Abräumen braucht die Stepper.
|
||||
content = eject.strip_end_motor_disable(content)
|
||||
else:
|
||||
if slots and mapping:
|
||||
_, mapping, filaments, _ = acm.align_tools_for_ace(
|
||||
b"", mapping, filaments
|
||||
)
|
||||
ace_tools = [item.get("paint_index") for item in mapping] if mapping else None
|
||||
size_mb = len(content) / (1024 * 1024)
|
||||
|
||||
def upload_progress(sent, total):
|
||||
|
||||
Reference in new issue
Block a user