Merge remote-tracking branch 'origin/master'
# Conflicts: # src/ui/test/test.py
This commit is contained in:
commit
43a2b38b38
@ -185,7 +185,7 @@ try:
|
||||
self.main_window.users_management_a.triggered.connect(lambda checked, self=weakref.ref(self): self().main_window.open_dialog(Users_Management()))
|
||||
self.main_window.table_selection_a.triggered.connect(self.set_recipe_mode_table)
|
||||
self.main_window.barcode_selection_a.triggered.connect(self.set_recipe_mode_barcode)
|
||||
|
||||
self.main_window.ristampa_etichetta_a.triggered.connect(self.reprint_label)
|
||||
if "--users-management" in sys.argv:
|
||||
self.main_window.users_management_a.trigger()
|
||||
|
||||
@ -252,7 +252,8 @@ try:
|
||||
|
||||
def set_recipe_mode_barcode(self):
|
||||
self.main_window.centralWidget().set_recipe_mode_barcode()
|
||||
|
||||
def reprint_label(self):
|
||||
self.main_window.centralWidget().reprint_label()
|
||||
if __name__ == "__main__":
|
||||
app = QApplication(sys.argv)
|
||||
|
||||
|
||||
@ -65,6 +65,7 @@
|
||||
<addaction name="logout_a"/>
|
||||
<addaction name="table_selection_a"/>
|
||||
<addaction name="barcode_selection_a"/>
|
||||
<addaction name="ristampa_etichetta_a"/>
|
||||
</widget>
|
||||
<addaction name="menuStrumenti"/>
|
||||
<addaction name="admin_m"/>
|
||||
@ -120,6 +121,11 @@
|
||||
<string>Selezione ricetta da barcode</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="ristampa_etichetta_a">
|
||||
<property name="text">
|
||||
<string>Ristampa etichetta</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
||||
@ -191,6 +191,8 @@ class Test(Widget):
|
||||
def set_recipe_mode_barcode(self):
|
||||
self.recipe_selection_mode = "barcode"
|
||||
self.change_recipe()
|
||||
def reprint_label(self):
|
||||
self.print(self.archived, self.print_step.spec.get("template", "EtichettaR5"))
|
||||
|
||||
def fail_cycle(self):
|
||||
self.next(action="fail")
|
||||
@ -219,9 +221,9 @@ class Test(Widget):
|
||||
|
||||
def next(self, action=None):
|
||||
if self.step is not None:
|
||||
self.log.debug(f"cycle next: cycle step: {model_to_dict(self.step)!r} action: {action!r}")
|
||||
self.log.info(f"cycle step: {model_to_dict(self.step)!r} action: {action!r} current index:{self.cycle_index}")
|
||||
else:
|
||||
self.log.debug(f"cycle next: cycle step: {self.step!r} action: {action!r}")
|
||||
self.log.info(f"cycle step: {self.step!r} action: {action!r} current index:{self.cycle_index}")
|
||||
current_w = self.centralWidget
|
||||
if hasattr(current_w, "stop"):
|
||||
current_w.stop()
|
||||
@ -232,6 +234,8 @@ class Test(Widget):
|
||||
self.cycle_available_steps["leak_2"].widget.recipe_written = False
|
||||
self.step = Steps(type="select_recipe")
|
||||
self.cycle_index = -1
|
||||
self.recipe=None
|
||||
self.cycle_steps=None
|
||||
# COUNT RESET
|
||||
self.pieces["ok"] = 0
|
||||
self.pieces["ko"] = 0
|
||||
@ -250,8 +254,10 @@ class Test(Widget):
|
||||
if self.recipe is None or self.cycle_steps is None:
|
||||
# if recipe not set: select_recipe
|
||||
if self.recipe_selection_mode == "barcode":
|
||||
self.log.info(f"returning to barcode recipe selection")
|
||||
self.step = Steps(type="barcode_recipe_selection")
|
||||
else:
|
||||
self.log.info(f"returning to recipe selection table")
|
||||
self.step = Steps(type="select_recipe")
|
||||
elif action is None:
|
||||
if self.autotest_request is not False and self.autotest_cycle_steps is not None and not self.autotesting and (self.cycle_index == -1 or self.cycle_index + 1 >= len(self.cycle_steps)):
|
||||
@ -300,7 +306,7 @@ class Test(Widget):
|
||||
"select_recipe",
|
||||
"wait",
|
||||
})
|
||||
self.log.info(f"cycle next: next cycle step: {model_to_dict(self.step)!r}")
|
||||
self.log.info(f"next cycle step: {model_to_dict(self.step)!r}")
|
||||
# INIT TEST DATA IF STARTING CYCLE LOOP OR IF RESET IS NEEDED
|
||||
if self.cycle_index == 0:
|
||||
self.data = {"ok": True, "overridden": False}
|
||||
@ -452,13 +458,13 @@ class Test(Widget):
|
||||
w.reset()
|
||||
# UPDATE RECIPE DISPLAY
|
||||
if self.recipe is not None:
|
||||
self.log.info(f"cycle recipe: {model_to_dict(self.recipe)!r} cycle steps: {[model_to_dict(s) for s in self.cycle_steps]}")
|
||||
self.log.info(f"set recipe: {model_to_dict(self.recipe)!r} cycle steps: {[model_to_dict(s) for s in self.cycle_steps]}")
|
||||
self.recipe_l.setText(self.recipe.name)
|
||||
self.recipe_l.setStyleSheet("")
|
||||
self.cycle_index = -1
|
||||
self.next()
|
||||
else:
|
||||
self.log.info(f"cycle recipe: {self.recipe!r} cycle steps: {self.cycle_steps}")
|
||||
self.log.info(f"set recipe: {self.recipe!r} cycle steps: {self.cycle_steps}")
|
||||
self.recipe_l.setText("NON SELEZIONATA")
|
||||
self.recipe_l.setStyleSheet("QLabel { color: red; }")
|
||||
|
||||
@ -520,7 +526,7 @@ class Test(Widget):
|
||||
def done(self, ok=True):
|
||||
self.log.info("cycle done, saving data...")
|
||||
|
||||
#remove useless info
|
||||
# remove useless info
|
||||
self.data.get("recipe",{}).get("spec",{}).pop("steps",None)
|
||||
self.data.get("recipe",{}).get("spec",{}).pop("available_steps",None)
|
||||
for leak in ["leak_1","leak_2"]:
|
||||
@ -597,7 +603,7 @@ class Test(Widget):
|
||||
psetminp2_a = leak_test_2_step_spec.get("settling_pressure_min_percent", 0) * (100+leak_test_2_step_spec.get("test_pressure_qneg", 0)/100)
|
||||
psetmaxp2_a = leak_test_2_step_spec.get("settling_pressure_max_percent", 0) * (100+leak_test_2_step_spec.get("test_pressure_qpos", 0)/100)
|
||||
leak_test_1_results["Running test: pressure at the end of measure"] = leak_test_1_results["Running test: pressure at the end of settling"] - leak_test_1_results["Running test: measured leak"]
|
||||
printer_fields = self.step.spec
|
||||
printer_fields = self.print_step.spec
|
||||
context = {
|
||||
# RECIPE DATA
|
||||
"RECIPE": self.labellify(recipe.get("name", "-")),
|
||||
|
||||
@ -101,7 +101,9 @@ class Test_Instructions(Test_Test):
|
||||
QApplication.processEvents()
|
||||
|
||||
def get(self, data=None, override=False):
|
||||
|
||||
if self.parent_assembly_widget().parent().step.type == "select_recipe":
|
||||
self.stop()
|
||||
return
|
||||
if self.done: # avoid proccessing if completed
|
||||
return
|
||||
if data is None:
|
||||
@ -122,15 +124,18 @@ class Test_Instructions(Test_Test):
|
||||
self.inputs[sensor_index] = False
|
||||
ok = False
|
||||
if ok:
|
||||
self.stop()
|
||||
super().get([{
|
||||
"time": timing(),
|
||||
"results": {
|
||||
"ok": ok,
|
||||
},
|
||||
}], override=override, fail=ok is False, skip_delay=False)
|
||||
self.timer.stop()
|
||||
self.set_done()
|
||||
|
||||
self.toggle_icons()
|
||||
|
||||
|
||||
def set_done(self):
|
||||
self.done=True
|
||||
self.done_ok=True
|
||||
@ -140,6 +145,7 @@ class Test_Instructions(Test_Test):
|
||||
#self.done=True
|
||||
#self.done_ok = True
|
||||
self.timer.stop()
|
||||
self.disconnect(self.get_connection)
|
||||
super().stop()
|
||||
|
||||
def reset(self):
|
||||
|
||||
@ -275,11 +275,11 @@ class Test_Leak(Test_Test):
|
||||
|
||||
def set_digital_out(self,name=None,state=1):
|
||||
if self.io_ok:
|
||||
bit=int(self.parent.config["digital_io"][name])
|
||||
bit = int(self.parent.config["digital_io"][name])
|
||||
ret = self.components["digital_io"].set_bit_verify(0,bit,state)
|
||||
if not ret:
|
||||
QMessageBox.critical(None, "ERRORE", f"ERRORE I/O DIGITALE - VERIFICARE CONNESSIONE USB")
|
||||
self.io_ok=False
|
||||
self.io_ok = False
|
||||
|
||||
def save_last(self):
|
||||
if self.last is None:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user