diff --git a/config/instruction_images/st-ten-5/5802850926.svg b/config/instruction_images/st-ten-5/5802850926.svg new file mode 100644 index 0000000..06ac2b0 --- /dev/null +++ b/config/instruction_images/st-ten-5/5802850926.svg @@ -0,0 +1,72 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/config/instruction_images/st-ten-5/5802963598.svg b/config/instruction_images/st-ten-5/5802963598.svg new file mode 100644 index 0000000..2cf4889 --- /dev/null +++ b/config/instruction_images/st-ten-5/5802963598.svg @@ -0,0 +1,91 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/config/instruction_images/st-ten-5/5802963681.svg b/config/instruction_images/st-ten-5/5802963681.svg new file mode 100644 index 0000000..77084ff --- /dev/null +++ b/config/instruction_images/st-ten-5/5802963681.svg @@ -0,0 +1,79 @@ + + + + diff --git a/config/label_designs/TUBI RISCALDATI/ETA013.btw b/config/label_designs/TUBI RISCALDATI/ETA013.btw index 6f710cf..29fc523 100644 Binary files a/config/label_designs/TUBI RISCALDATI/ETA013.btw and b/config/label_designs/TUBI RISCALDATI/ETA013.btw differ diff --git a/config/label_designs/TUBI RISCALDATI/ETA013_OLD.btw b/config/label_designs/TUBI RISCALDATI/ETA013_OLD.btw new file mode 100644 index 0000000..f905dd1 Binary files /dev/null and b/config/label_designs/TUBI RISCALDATI/ETA013_OLD.btw differ diff --git a/config/label_designs/TUBI RISCALDATI/ETA013_PM.btw b/config/label_designs/TUBI RISCALDATI/ETA013_PM.btw new file mode 100644 index 0000000..f87cc20 Binary files /dev/null and b/config/label_designs/TUBI RISCALDATI/ETA013_PM.btw differ diff --git a/config/label_designs/TUBI RISCALDATI/TEXA.btw b/config/label_designs/TUBI RISCALDATI/TEXA.btw new file mode 100644 index 0000000..5598a83 Binary files /dev/null and b/config/label_designs/TUBI RISCALDATI/TEXA.btw differ diff --git a/config/label_templates/ETA013L.prn b/config/label_templates/ETA013L.prn index 140631d..43172a9 100644 --- a/config/label_templates/ETA013L.prn +++ b/config/label_templates/ETA013L.prn @@ -9,39 +9,39 @@ SET PARTIAL_CUTTER OFF SET TEAR ON CLS CODEPAGE 1252 -TEXT 203,221,"0",180,9,9,"{TSET}s" -TEXT 205,374,"0",180,9,9,"{RESPFILL}mbar" -TEXT 260,792,"0",180,9,9,"{CLIENT}" -TEXT 336,987,"0",180,12,12,"ERRECINQUE" -TEXT 292,923,"0",180,8,8,"Fluid system" -TEXT 307,894,"0",180,8,8,"Via Meucci 31/A" -TEXT 333,865,"0",180,8,8,"10079 Mappano (TO)" -TEXT 375,792,"0",180,9,9,"Cliente:" -TEXT 375,763,"0",180,9,9,"N. disegno:" -TEXT 375,732,"0",180,9,9,"N. dis. R5:" -TEXT 375,702,"0",180,9,9,"N. pezzo:" -TEXT 375,671,"0",180,9,9,"Data/ora prova:" -TEXT 375,640,"0",180,9,9,"{DATETIME}" -TEXT 252,763,"0",180,9,9,"{RECIPE}" -TEXT 222,732,"0",180,9,9,"{PART}" -TEXT 241,702,"0",180,9,9,"{SN}" -BARCODE 384,583,"128M",102,0,180,2,4,"!105{BCODE}" -TEXT 381,374,"0",180,9,9,"P. riempimento:" -TEXT 381,336,"0",180,9,9,"P. assestamento:" -TEXT 381,298,"0",180,9,9,"Caduta:" -TEXT 203,336,"0",180,9,9,"{RESPSET}mbar" -TEXT 203,298,"0",180,9,9,"{RESLEAK}mbar" -TEXT 381,259,"0",180,9,9,"T. riemp:" -TEXT 381,221,"0",180,9,9,"T. stab:" -TEXT 381,182,"0",180,9,9,"T. prova:" -TEXT 204,259,"0",180,9,9,"{TFILL}s" -TEXT 203,182,"0",180,9,9,"{TTEST}s" -TEXT 381,143,"0",180,9,9,"Caduta MAX" -TEXT 381,104,"0",180,9,9,"Press nominale" -TEXT 203,143,"0",180,9,9,"{PMIN}mbar" -TEXT 203,104,"0",180,9,9,"{PTEST}mbar" -TEXT 375,67,"0",180,11,11,"ESITO:" -TEXT 274,67,"0",180,11,11,"{RESULT}" -TEXT 312,450,"0",180,8,8,"{BCODE}" +TEXT 203,232,"0",180,9,9,"{TSET}s" +TEXT 203,386,"0",180,9,9,"{RESPFILL}mbar" +TEXT 292,813,"0",180,9,9,"{CLIENT}" +TEXT 330,990,"0",180,12,12,"ERRECINQUE" +TEXT 292,930,"0",180,8,8,"Fluid system" +TEXT 307,901,"0",180,8,8,"Via Meucci 31/A" +TEXT 333,872,"0",180,8,8,"10079 Mappano (TO)" +TEXT 379,813,"0",180,9,9,"Cliente:" +TEXT 379,778,"0",180,9,9,"N. disegno:" +TEXT 379,736,"0",180,9,9,"N. dis. R5:" +TEXT 379,703,"0",180,9,9,"N. pezzo:" +TEXT 379,667,"0",180,9,9,"Data/ora prova:" +TEXT 379,632,"0",180,9,9,"{DATETIME}" +TEXT 257,778,"0",180,9,9,"{RECIPE}" +TEXT 257,743,"0",180,11,11,"{PART}" +TEXT 257,703,"0",180,9,9,"{SN}" +BARCODE 379,576,"128M",102,0,180,2,4,"!105{BCODE}" +TEXT 379,386,"0",180,9,9,"P. riempimento:" +TEXT 379,348,"0",180,9,9,"P. assestamento:" +TEXT 379,310,"0",180,9,9,"Caduta:" +TEXT 203,348,"0",180,9,9,"{RESPSET}mbar" +TEXT 203,310,"0",180,9,9,"{RESLEAK}mbar" +TEXT 379,271,"0",180,9,9,"T. riemp:" +TEXT 379,232,"0",180,9,9,"T. stab:" +TEXT 379,194,"0",180,9,9,"T. prova:" +TEXT 203,271,"0",180,9,9,"{TFILL}s" +TEXT 203,194,"0",180,9,9,"{TTEST}s" +TEXT 379,155,"0",180,9,9,"Caduta MAX" +TEXT 379,116,"0",180,9,9,"Press nominale" +TEXT 203,155,"0",180,9,9,"{PMIN}mbar" +TEXT 203,116,"0",180,9,9,"{PTEST}mbar" +TEXT 379,67,"0",180,11,11,"ESITO:" +TEXT 285,67,"0",180,11,11,"{RESULT}" +TEXT 379,464,"0",180,9,9,"{BCODE}" PRINT 1,1 \ No newline at end of file diff --git a/config/label_templates/ETA013_DEUTZ.prn b/config/label_templates/ETA013_DEUTZ.prn index fd96f50..072985f 100644 --- a/config/label_templates/ETA013_DEUTZ.prn +++ b/config/label_templates/ETA013_DEUTZ.prn @@ -25,7 +25,7 @@ TEXT 375,617,"0",180,9,9,"{DATETIME}" TEXT 252,766,"0",180,9,9,"{RECIPE}" TEXT 222,709,"0",180,9,9,"{PART}" TEXT 241,678,"0",180,9,9,"{SN}" -BARCODE 384,560,"128M",102,0,180,2,4,"!10500" +BARCODE 384,560,"128M",102,0,180,2,4,"!105{BCODE}" TEXT 381,374,"0",180,9,9,"P. riempimento:" TEXT 381,336,"0",180,9,9,"P. assestamento:" TEXT 381,298,"0",180,9,9,"Caduta:" diff --git a/config/label_templates/ETACL-40_130.prn b/config/label_templates/ETACL-40_130.prn index 3d374dc..e445358 100644 --- a/config/label_templates/ETACL-40_130.prn +++ b/config/label_templates/ETACL-40_130.prn @@ -1,4 +1,4 @@ -SIZE 37.5 mm, 130 mm +SIZE 27.5 mm, 50 mm GAP 3 mm, 0 mm SPEED 2 DENSITY 7 @@ -10,10 +10,9 @@ SET CUTTER OFF SET PARTIAL_CUTTER OFF SET TEAR ON CLS -DMATRIX 116,270,184,184,x3,22,22,"{RECIPE}-{DD}{MO}{YY}{SN5}" +DMATRIX 82,230,138,138,x3,22,22,"{RECIPE}-{DD}{MO}{YY}{SN5}" CODEPAGE 1252 -TEXT 261,377,"ROMAN.TTF",180,1,7,"{RECIPE}-{DD}{MO}{YY}{SN5}" -DMATRIX 116,175,184,184,x3,22,22,"{RECIPE}-{DD}{MO}{YY}{SN5}" -DMATRIX 116,78,184,184,x3,22,22,"{RECIPE}-{DD}{MO}{YY}{SN5}" -BOX 13,16,287,401,3 +TEXT 212,357,"ROMAN.TTF",180,1,7,"{RECIPE}-{DD}{MO}{YY}{SN5}" +DMATRIX 82,129,138,138,x3,22,22,"{RECIPE}-{DD}{MO}{YY}{SN5}" +DMATRIX 82,28,138,138,x3,22,22,"{RECIPE}-{DD}{MO}{YY}{SN5}" PRINT 1,1 diff --git a/config/label_templates/ETACL.prn b/config/label_templates/ETACL.prn index c610911..e445358 100644 --- a/config/label_templates/ETACL.prn +++ b/config/label_templates/ETACL.prn @@ -12,7 +12,7 @@ SET TEAR ON CLS DMATRIX 82,230,138,138,x3,22,22,"{RECIPE}-{DD}{MO}{YY}{SN5}" CODEPAGE 1252 -TEXT 212,357,"ROMAN.TTF",180,1,7,"{RECIPE}-{DD}{MO}{YY}" +TEXT 212,357,"ROMAN.TTF",180,1,7,"{RECIPE}-{DD}{MO}{YY}{SN5}" DMATRIX 82,129,138,138,x3,22,22,"{RECIPE}-{DD}{MO}{YY}{SN5}" DMATRIX 82,28,138,138,x3,22,22,"{RECIPE}-{DD}{MO}{YY}{SN5}" PRINT 1,1 diff --git a/config/machine_settings/st-ten-2.ini b/config/machine_settings/st-ten-2.ini index 8639302..8d57296 100644 --- a/config/machine_settings/st-ten-2.ini +++ b/config/machine_settings/st-ten-2.ini @@ -20,5 +20,38 @@ recipe_name_field: cod finito cliente part_number_field: cod finito r5 barcode_enable_field: verifica_codice_a_barre_abilitata barcode_serial_field: codice_a_barre -label_template_field: modello_etichetta -description_field: cod semilavorato costampato \ No newline at end of file +label_template_field: etichetta +description_field: cod semilavorato costampato + +[recipes_defaults] +prova_tenuta_abilitata: x +warning_img: +tempo_pre_riempimento: 0 +pressione_pre_riempimento: 1000 +tempo_riempimento: 10 +tempo_assestamento: 10 +percentuale_minima_pressione_assestamento: 5 +percentuale_massima_pressione_assestamento: 5 +tempo_di_test: 10 +pressione_di_test_delta_minimo: 30 +pressione_di_test: 15000 +pressione_di_test_delta_massimo: 30 +tempo_svuotamento: 1 +pressione_svuotamento: 100 +config_elettrovalvole: 0 + +[autotest_leak] +enabled: true +pre_filling_time: 0 +pre_filling_pressure: 1000 +filling_time: 5 +settling_time: 10 +settling_pressure_min_percent: 5 +settling_pressure_max_percent: 5 +test_time: 10 +test_pressure_min_delta: 5 +test_pressure: 9000 +test_pressure_max_delta: 5 +flush_time: 1 +flush_pressure: 100 +relay_config: 1 \ No newline at end of file diff --git a/config/machine_settings/st-ten-3.ini b/config/machine_settings/st-ten-3.ini index 33ddd83..9480412 100644 --- a/config/machine_settings/st-ten-3.ini +++ b/config/machine_settings/st-ten-3.ini @@ -24,3 +24,18 @@ barcode_enable_field: verifica_codice_a_barre_abilitata_cl [recipes_defaults] descrizione: +prova_tenuta_abilitata: x +warning_img: +tempo_pre_riempimento: 0 +pressione_pre_riempimento: 1000 +tempo_riempimento: 10 +tempo_assestamento: 10 +percentuale_minima_pressione_assestamento: 5 +percentuale_massima_pressione_assestamento: 5 +tempo_di_test: 10 +pressione_di_test_delta_minimo: 30 +pressione_di_test: 15000 +pressione_di_test_delta_massimo: 30 +tempo_svuotamento: 1 +pressione_svuotamento: 100 +config_elettrovalvole: 0 diff --git a/config/machine_settings/st-ten-5.ini b/config/machine_settings/st-ten-5.ini index 58b56e5..1ddd713 100644 --- a/config/machine_settings/st-ten-5.ini +++ b/config/machine_settings/st-ten-5.ini @@ -10,6 +10,7 @@ remote_api: absent tecna_t3: present digital_io: present barcode_recipe_selection: present +show_instructions: yes [tecna_t3] port: COM4 diff --git a/config/warning_images/generic/Img-06.png b/config/warning_images/generic/Img-06.png new file mode 100644 index 0000000..ae1b580 Binary files /dev/null and b/config/warning_images/generic/Img-06.png differ diff --git a/config/warning_images/generic/Img-07.png b/config/warning_images/generic/Img-07.png new file mode 100644 index 0000000..dcccb1d Binary files /dev/null and b/config/warning_images/generic/Img-07.png differ diff --git a/config/warning_images/generic/Img-08.png b/config/warning_images/generic/Img-08.png new file mode 100644 index 0000000..c794040 Binary files /dev/null and b/config/warning_images/generic/Img-08.png differ diff --git a/config/warning_images/generic/Img-09.png b/config/warning_images/generic/Img-09.png new file mode 100644 index 0000000..f66aa5b Binary files /dev/null and b/config/warning_images/generic/Img-09.png differ diff --git a/config/warning_images/generic/Img-10.png b/config/warning_images/generic/Img-10.png new file mode 100644 index 0000000..a8a3ffd Binary files /dev/null and b/config/warning_images/generic/Img-10.png differ diff --git a/config/warning_images/generic/Img-11.png b/config/warning_images/generic/Img-11.png new file mode 100644 index 0000000..0109a3d Binary files /dev/null and b/config/warning_images/generic/Img-11.png differ diff --git a/init_win.bat b/init_win.bat index c7208b9..c007c36 100644 --- a/init_win.bat +++ b/init_win.bat @@ -2,6 +2,8 @@ :: RUN FROM POWERSHELL W/ADMIN RIGHTS: :: Set-ExecutionPolicy Unrestricted -Scope CurrentUser +pip install -r src/requirements.txt + cd tmp :: GXIPY diff --git a/runme_custom.sh b/runme_custom.sh deleted file mode 100755 index bd9a5cb..0000000 --- a/runme_custom.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -e -cd "$(dirname "$0")" -source "./venv/bin/activate" || source "./venv/Scripts/activate" || : -python -O "./src/main.py" --no-edgetpu --no-tflite $* diff --git a/simulate.sh b/simulate.sh index d84e9bf..52c9e61 100755 --- a/simulate.sh +++ b/simulate.sh @@ -16,7 +16,6 @@ python -B -u "./src/main.py" \ --auto-accept-test-admin-permission \ --auto-login-admin \ --auto-select \ ---debugger-workaround \ --no-edgetpu \ --no-gpu \ --panel \ diff --git a/src/components/usb_586x.py b/src/components/usb_586x.py index 2236480..e4d12c1 100644 --- a/src/components/usb_586x.py +++ b/src/components/usb_586x.py @@ -158,7 +158,7 @@ class USB_586x(Component): read = [] if is_win or self.simulate: if self.simulate: - read.append(bytearray(0)) + read=[1,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0] else: ret = self.di_read(0, self.in_size) if ret[0].value == ErrorCode.Success.value: diff --git a/src/lib/db/models/users.py b/src/lib/db/models/users.py index 2eae003..ad3423d 100755 --- a/src/lib/db/models/users.py +++ b/src/lib/db/models/users.py @@ -136,11 +136,9 @@ class Users(BaseModel): def delete_by_username(cls, username): cls.update(password="").where(cls.username == username).execute() - @classmethod - def delete(cls, *args, **kwargs): - # OVERRIDE DELETION - # so that deleting a user will only disable it - return cls.update(password="") +# @classmethod +# def delete(cls, *args, **kwargs): +# return cls.delete() @property def is_admin(self): diff --git a/src/test/csv_import/Tabella_e_daily_p3.csv b/src/test/csv_import/Tabella_e_daily_p3.csv new file mode 100644 index 0000000..186549c --- /dev/null +++ b/src/test/csv_import/Tabella_e_daily_p3.csv @@ -0,0 +1,40 @@ +codice_ricetta,Priorita ,descrizione,etichette_supplementari,Numero nastri (N),Numero sensori anello (SA),Numero sensori presenza (SP) +5803223729,3,priorita  3,,,, +5803223730,3,priorita  3,,,, +5803223731,3,priorita  3,,,, +5803223732,3,priorita  3,,,, +5803223733,3,priorita  3,,,, +5803223734,3,priorita  3,,,, +5803223735,3,priorita  3,,,, +5803223736,3,priorita  3,,,, +5803223737,3,priorita  3,,,, +5803223738,3,priorita  3,,,, +5803223739,3,priorita  3,,,, +5803223740,3,priorita  3,,,, +5803223741,3,priorita  3,,,, +5803223742,3,priorita  3,,,, +5803223743,3,priorita  3,,,, +5803223744,3,priorita  3,,,, +5803223745,3,priorita  3,,,, +5803223746,3,priorita  3,,,, +5803223747,3,priorita  3,,,, +5803223748,3,priorita  3,,,, +5803223749,3,priorita  3,,,, +5803223750,3,priorita  3,,,, +5803223751,3,priorita  3,,,, +5803223752,3,priorita  3,,,, +5803223753,3,priorita  3,,,, +5803120372,3,priorita  3,,,, +5803120373,3,priorita  3,,,, +5803120374,3,priorita  3,,,, +5803120375,3,priorita  3,,,, +5803101543,3,priorita  3,,,, +5803101544,3,priorita  3,,,, +5803101545,3,priorita  3,,,, +5803101546,3,priorita  3,,,, +5803101547,3,priorita  3,,,, +5803223754,3,priorita  3,,,, +5803223755,3,priorita  3,,,, +5803120371,3,priorita  3,,,, +5803228584,3,priorita  3,,,, +5803228585,3,priorita  3,,,, diff --git a/src/ui/recipe_selection/recipe_selection.py b/src/ui/recipe_selection/recipe_selection.py index 6410378..7cba138 100755 --- a/src/ui/recipe_selection/recipe_selection.py +++ b/src/ui/recipe_selection/recipe_selection.py @@ -1,8 +1,6 @@ import csv -import itertools import locale import os -import re import sys import weakref from glob import glob @@ -39,16 +37,13 @@ class Recipe_Selection(Widget): self.unsupported_steps.add("second_leak_test") session = Users.get_session() if session.is_admin: - # readonly = ["id"] readonly = False crud_aliases = { - # "id": "Id", "name": "Ricetta", "client": "Cliente", "part_number": "N° disegno", "spec": "Specifica", "description": "Descrizione", - # "archived": "Archiviata", } filters = None else: @@ -59,7 +54,6 @@ class Recipe_Selection(Widget): "part_number": "N° disegno", "spec": "Specifica", "description": "Descrizione", - # "archived": "Archiviata", } filters = {"archived": False} step_defaults = self.read_steps(self.config.get("recipes_defaults", noner), noner) diff --git a/src/ui/test/test.py b/src/ui/test/test.py index 695e620..75e492f 100755 --- a/src/ui/test/test.py +++ b/src/ui/test/test.py @@ -93,7 +93,7 @@ class Test(Widget): "emergency": Test_Assembly(img_path=self.select_step_img("reset_emergency"), text=u"EMERGENZA INTERVENUTA - RIPRISTINARE PULSANTE E SELEZIONARE \"RESET EMERGENZA\" DAL MEN\u00d9 \"STRUMENTI\"", widget=None), "fail": Test_Assembly(img_path=self.select_step_img("fail"), text=u"CICLO INTERROTTO, PREMERE CONTINUA PER COMINCIARE UN NUOVO CICLO", widget=Test_Fail()), "leak_1": Test_Assembly(img_path=None, text=None, widget=Test_Leak(components=self.components, recipe=self.recipe, step=self.step, pieces=self.pieces,parent=self)), - "leak_2": Test_Assembly(img_path=None, text=None, widget=Test_Leak(components=self.components, recipe=self.recipe, step=self.step, pieces=self.pieces)), + "leak_2": Test_Assembly(img_path=None, text=None, widget=Test_Leak(components=self.components, recipe=self.recipe, step=self.step, pieces=self.pieces,parent=self)), "instruction": Test_Assembly(img_path=None, text=u"ESEGUIRE LE OPERAZIONI DI MONTAGGIO INDICATE IN FIGURA", widget=Test_Instructions(components=self.components, recipe=self.recipe,bench_name=self.config.machine_id, step=self.step)), "print": Test_Assembly(img_path=self.select_step_img("print"), text=u"STAMPA ETICHETTA IN CORSO", widget=None), "resistance": Test_Assembly(img_path=None, text=u"COLLEGARE CONNETTORE ELETTRICO PER EFFETTUARE PROVA RESISTENZA", widget=Test_Resistance(components=self.components, recipe=self.recipe, step=self.step, pieces=self.pieces)), @@ -195,7 +195,7 @@ class Test(Widget): self.autotest_timer = QTimer() self.autotest_timer.setSingleShot(False) self.autotest_timer.timeout.connect(self.request_periodic_autotest) - self.time_timer.start(self.autotest_period) + self.autotest_timer.start(self.autotest_period) reason = "boot" self.autotest_request = reason @@ -474,6 +474,7 @@ class Test(Widget): if self.autotesting: self.data["autotest"] = True self.data["autotest_reason"] = self.autotesting_reason + self.data["recipe"]["name"] = "AUTOTEST" archived = Archive.archive(self.data, ok and self.data["ok"], overridden=self.data["overridden"]) self.log.info(f"cycle archived locally: {archived!r}") if not self.autotesting: diff --git a/src/ui/test_connector/test_connector.py b/src/ui/test_connector/test_connector.py index 69a6eaa..af8f0a5 100644 --- a/src/ui/test_connector/test_connector.py +++ b/src/ui/test_connector/test_connector.py @@ -90,4 +90,4 @@ class Test_Connector(Test_Test): return barcode is not None and len(barcode) def set_focus(self): - self.barcodes_le.setFocus() + self.connector_le.setFocus() diff --git a/src/ui/test_instructions/test_instructions.py b/src/ui/test_instructions/test_instructions.py index 925620b..0c18da5 100644 --- a/src/ui/test_instructions/test_instructions.py +++ b/src/ui/test_instructions/test_instructions.py @@ -21,6 +21,7 @@ class Test_Instructions(Test_Test): self.svgWidget=None self.svg_root=None self.flag=False + self.inputs={} self.svg_widget=QtSvg.QSvgWidget() self.layout = QVBoxLayout() self.layout.addWidget(self.svg_widget) @@ -31,12 +32,7 @@ class Test_Instructions(Test_Test): def start(self, recipe=None, step=None, pieces=None): show = super().start(recipe=recipe, step=step) - ring_ids=[f"ring_{i+1}" for i in range(step.spec["num_ring"])] - piece_ids=[f"piece_{i+1}" for i in range(step.spec["num_piece"])] - tape_ids=[f"tape_{i+1}" for i in range(step.spec["num_tape"])] - self.ids=ring_ids+piece_ids - self.inputs= {idx: {"id":id,"status":False} for idx,id in enumerate(self.ids)} - self.tapes = {idx: {"id": id, "status": False} for idx, id in enumerate(tape_ids)} + self.timer.start(1000) # setup test loop self.get_connection = self.components["digital_io"].out.connect(self.get) @@ -48,22 +44,26 @@ class Test_Instructions(Test_Test): self.svg_root = etree.parse(svg_path) self.svg_str = etree.tostring(self.svg_root) self.svg_str=etree.tostring(self.svg_root) + + self.monitored_ids=self.svg_root.xpath(f'''.//*[starts-with(@id, 'sensor_')]''') + + self.tape_ids=self.svg_root.xpath(f'''.//*[starts-with(@id, 'tape_')]''') + self.done = False return show def toggle_icons(self): self.flag = not self.flag - for idx,tape in self.tapes.items(): - elem = self.svg_root.findall(f'''.//*[@id='{tape["id"]}']''')[0] + for elem in self.tape_ids: if self.flag: self.show_tape(elem) else: self.hide_tape(elem) - for idx,input in self.inputs.items(): - elem = self.svg_root.findall(f'''.//*[@id='{input["id"]}']''')[0] - if input["status"]: + for elem in self.monitored_ids: + sensor_index = int(elem.attrib['id'].split("_")[1]) - 3 + if self.inputs[sensor_index]: self.show_ok(elem) self.show_icon(elem) else: @@ -76,9 +76,9 @@ class Test_Instructions(Test_Test): self.show_svg() def show_ok(self,id): - id.attrib["{http://www.w3.org/1999/xlink}href"]= f"{self.svg_path}ok.png" + id.attrib["{http://www.w3.org/1999/xlink}href"]= f"{self.svg_path}img/ok.png" def show_ko(self,id): - id.attrib["{http://www.w3.org/1999/xlink}href"]= f"{self.svg_path}arw-yel-down.png" + id.attrib["{http://www.w3.org/1999/xlink}href"]= f"{self.svg_path}img/arw-yel-down.png" def show_icon(self,id): id.set("display", "inline") @@ -87,7 +87,7 @@ class Test_Instructions(Test_Test): id.set("display", "none") def show_tape(self,id): - id.attrib["{http://www.w3.org/1999/xlink}href"]= f"{self.svg_path}tape_black.png" + id.attrib["{http://www.w3.org/1999/xlink}href"]= f"{self.svg_path}img/tape_black.png" id.set("display", "inline") def hide_tape(self,id): @@ -110,13 +110,14 @@ class Test_Instructions(Test_Test): ok = True if len(data[0]["digital_io"])==0: return - for sensor_index,sensor in enumerate(self.ids): + for sensor in self.monitored_ids: + sensor_index = int(sensor.attrib['id'].split("_")[1])-3 byte_idx=int(sensor_index/8) bit_idx=sensor_index%8 if data[0]["digital_io"][byte_idx][bit_idx]: - self.inputs[sensor_index]["status"]=True + self.inputs[sensor_index] = True else: - self.inputs[sensor_index]["status"] = False + self.inputs[sensor_index] = False ok = False if ok: super().get([{ diff --git a/src/ui/test_leak/test_leak.py b/src/ui/test_leak/test_leak.py index 88b233b..7bcf1e4 100644 --- a/src/ui/test_leak/test_leak.py +++ b/src/ui/test_leak/test_leak.py @@ -2,18 +2,26 @@ import sys import time import weakref -from PyQt5.QtWidgets import QMessageBox +from PyQt5.QtWidgets import QMessageBox, QDialog +from ui import Dialog from ui.test_test import Test_Test from components.Automation.BDaq import ErrorCode class Test_Leak(Test_Test): def __init__(self, components=None, recipe=None, step=None, pieces=None, run_once=False, reset_on_start=True, enable_override=False,parent=None): super().__init__(components=components, recipe=recipe, step=step, pieces=pieces, run_once=run_once, reset_on_start=reset_on_start, enable_override=enable_override) + self.parent=parent self.step=step self.start_b.clicked.connect(self.start_test) self.stop_b.clicked.connect(lambda checked, self=weakref.ref(self): self().components["tecna_t3"].stop_test()) - self.parent=parent + self.show_instruction_b.setVisible("show_instructions" in self.parent.config["hardware_config"].keys()) + self.show_instruction_b.clicked.connect(self.show_instruction) + + def show_instruction(self): + dialog=Dialog() + dialog.setCentralWidget(self.parent.cycle_available_steps["instruction"]) + dialog.show() def start_test(self): # print extra labels @@ -98,10 +106,13 @@ class Test_Leak(Test_Test): if "Running test: result" in data["tecna_t3"]: result = data["tecna_t3"]["Running test: result"] - if self.step.spec.get("autotest", False) is not True: - ok = type(result) is str and "passed" in result.lower() + step=self.step.spec.get("autotest", "") + if step == "ok_check": + ok = type(result) is str and "passed" in result.lower() # AUTOTEST - NO LEAK + elif step == "ko_check": + ok = type(result) is str and "failed" in result.lower() # AUTOTEST - LEAK else: - ok = type(result) is str and "failed" in result.lower() + ok = type(result) is str and "passed" in result.lower() # NORMAL TEST if "digital_io" in self.components.keys(): # RESET RELAYS diff --git a/src/ui/test_leak/test_leak.ui b/src/ui/test_leak/test_leak.ui index 90ef48e..4b73aae 100644 --- a/src/ui/test_leak/test_leak.ui +++ b/src/ui/test_leak/test_leak.ui @@ -6,8 +6,8 @@ 0 0 - 370 - 491 + 1424 + 806 @@ -26,7 +26,7 @@ 0 - + @@ -39,8 +39,8 @@ PROVA TENUTA - - + + 16 @@ -49,15 +49,54 @@ - Tipo di test + mbar + + + + + + + + 130 + 16777215 + + + + + 20 + 50 + false + + + + background-color: rgb(255, 255, 255); +border: 1px solid black; + + + + - + + + + + + + + 16 + 50 + false + + + + Indice di sequenza del test Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - + + 16 @@ -66,10 +105,7 @@ - Pressione del circuito - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + mbar @@ -107,17 +143,11 @@ - - - - - 130 - 16777215 - - + + - 20 + 16 50 false @@ -132,6 +162,54 @@ border: 1px solid black; + + + + + 16 + 50 + false + + + + Tipo di test + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 16 + 50 + false + + + + Pressione del circuito + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 16 + 50 + false + + + + mbar + + + @@ -187,8 +265,27 @@ border: 1px solid black; - - + + + + + 16 + 50 + false + + + + background-color: rgb(255, 255, 255); +border: 1px solid black; + + + + - + + + + + 130 @@ -212,65 +309,6 @@ border: 1px solid black; - - - - - 16 - 50 - false - - - - Indice di sequenza del test - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 16 - 50 - false - - - - mbar - - - - - - - - 16 - 50 - false - - - - mbar - - - - - - - - 16 - 50 - false - - - - mbar - - - @@ -283,44 +321,6 @@ border: 1px solid black; background-color: rgb(255, 255, 255); border: 1px solid black; - - - - - - - - - - - - - 16 - 50 - false - - - - background-color: rgb(255, 255, 255); -border: 1px solid black; - - - - - - - - - - - - - 16 - 50 - false - - - - background-color: rgb(255, 255, 255); -border: 1px solid black; @@ -331,7 +331,27 @@ border: 1px solid black; - + + + + + 0 + 0 + + + + + 12 + 75 + true + + + + FORZA ACCETTAZIONE + + + + @@ -345,6 +365,12 @@ border: 1px solid black; 100 + + + 16777215 + 16777215 + + @@ -802,7 +828,7 @@ border: 1px solid black; - + @@ -856,7 +882,7 @@ border: 1px solid black; - + @@ -870,6 +896,12 @@ border: 1px solid black; 100 + + + 16777215 + 16777215 + + @@ -1327,23 +1359,474 @@ border: 1px solid black; - - + + - + 0 0 + + + 0 + 100 + + + + + + + + + 0 + 0 + 0 + + + + + + + 112 + 112 + 255 + + + + + + + 255 + 127 + 127 + + + + + + + 255 + 63 + 63 + + + + + + + 127 + 0 + 0 + + + + + + + 170 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 112 + 112 + 255 + + + + + + + 112 + 112 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 127 + 127 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + + + + + + + 112 + 112 + 255 + + + + + + + 255 + 127 + 127 + + + + + + + 255 + 63 + 63 + + + + + + + 127 + 0 + 0 + + + + + + + 170 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 112 + 112 + 255 + + + + + + + 112 + 112 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 127 + 127 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + + + 127 + 0 + 0 + + + + + + + 112 + 112 + 255 + + + + + + + 255 + 127 + 127 + + + + + + + 255 + 63 + 63 + + + + + + + 127 + 0 + 0 + + + + + + + 170 + 0 + 0 + + + + + + + 127 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 127 + 0 + 0 + + + + + + + 112 + 112 + 255 + + + + + + + 112 + 112 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 0 + 0 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + - 12 + 20 75 true + + background-color:rgb(112, 112, 255); + - FORZA ACCETTAZIONE + MOSTRA ISTRUZIONE