wip
This commit is contained in:
parent
5bba17f5d3
commit
c5ab2f16dd
@ -79,10 +79,7 @@ class Component(QObject):
|
||||
self._set_sources.connect(self._do_set_sources)
|
||||
self._set_period.connect(self._do_set_period)
|
||||
if self.config is not None:
|
||||
try:
|
||||
self.config.updated.connect(self._config_changed)
|
||||
except AttributeError:
|
||||
pass
|
||||
self._config_changed()
|
||||
self._init_periodic()
|
||||
self._started = True
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
@ -12,7 +13,7 @@ class Os_Label_Printer(Component):
|
||||
self.simulate = False
|
||||
if "--sim-os-label-printer" in sys.argv:
|
||||
self.simulate = True
|
||||
self.platform = "windows"
|
||||
|
||||
def config_changed(self):
|
||||
self.platform = self.config[self.name]["platform"]
|
||||
# for windows:
|
||||
@ -32,6 +33,7 @@ class Os_Label_Printer(Component):
|
||||
label = f.read()
|
||||
# LABEL PRINT
|
||||
label = label.format(**context)
|
||||
os.makedirs("tmp", exist_ok=True)
|
||||
label_file = "tmp/label.prn"
|
||||
with open(label_file, "w", errors="surrogateescape") as f:
|
||||
label = f.write(label)
|
||||
|
||||
@ -285,18 +285,18 @@ class Test(Widget):
|
||||
"PIECE_NUM": str(self.data.get("barcodes", {}).get("serial", "-")),
|
||||
"DATETIME": str(archived.time.isoformat()),
|
||||
"SHIFT": str(get_shift(archived.time)),
|
||||
"STATION": self.machine_id,
|
||||
"STATION": str(self.machine_id),
|
||||
"OPERATOR": str(Users.get_session().user.username),
|
||||
"PMAX": "-",
|
||||
"PMIN": "-",
|
||||
"LEAK": "-",
|
||||
"TFILL": "-",
|
||||
"TSTAB": "-",
|
||||
"TTEST": "-",
|
||||
"MAXLEAK": "-",
|
||||
"PTESTMIN": "-",
|
||||
"RESULT_L1": str(self.data.get("leak", [{}, {}])[0].get("results", {}).get("result", "FAIL")),
|
||||
"RESULT_L2": str(self.data.get("leak", [{}, {}])[1].get("results", {}).get("result", "FAIL")),
|
||||
"PMAX": str(self.data.get("leak", [{}, {}])[0].get("step", {}).get("spec", {}).get("test_pressure", "-")),
|
||||
"PMIN": str(self.data.get("leak", [{}, {}])[0].get("results", {}).get("data", {}).get("Running test: pressure at the end of settling", "-")),
|
||||
"LEAK": str(self.data.get("leak", [{}, {}])[0].get("results", {}).get("data", {}).get("Running test: measured leak", "-")),
|
||||
"TFILL": str(self.data.get("leak", [{}, {}])[0].get("step", {}).get("spec", {}).get("filling_time", "-")),
|
||||
"TSTAB": str(self.data.get("leak", [{}, {}])[0].get("step", {}).get("spec", {}).get("settling_time", "-")),
|
||||
"TTEST": str(self.data.get("leak", [{}, {}])[0].get("step", {}).get("spec", {}).get("test_time", "-")),
|
||||
"MAXLEAK": str(self.data.get("leak", [{}, {}])[0].get("step", {}).get("spec", {}).get("test_pressure_max_delta", "-")),
|
||||
"PTESTMIN": str(self.data.get("leak", [{}, {}])[0].get("step", {}).get("spec", {}).get("test_pressure_min_delta", "-")),
|
||||
"RESULT_L1": "ESITO",
|
||||
"RESULT_L2": str("CONFORME" if self.data.get("leak", [{}, {}])[0].get("results", {}).get("ok", False) else "SCARTO"),
|
||||
}
|
||||
self.components["label_printer"].print_label("EtichettaR5", context=context)
|
||||
self.log.info(f"cycle printed: {context!r}")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user