From 13684e8ab6120a27298943be46853d9f171799fe Mon Sep 17 00:00:00 2001 From: neo-dl Date: Tue, 18 Jul 2023 16:47:06 +0200 Subject: [PATCH] instruction reminder ok --- config/machine_settings/st-ten-5.ini | 9 +- src/components/archive_synchronizer.py | 2 + src/test/csv_import/Tabella_e_daily.csv | 382 +++++++++--------- src/test/csv_import/Tabella_e_dailyP345.csv | 48 +++ src/ui/__init__.py | 5 +- src/ui/test_instructions_reminder/__init__.py | 1 + .../test_instructions_reminder.py | 78 ++++ .../test_instructions_reminder.ui | 74 ++++ src/ui/test_leak/test_leak.py | 4 +- 9 files changed, 405 insertions(+), 198 deletions(-) create mode 100644 src/test/csv_import/Tabella_e_dailyP345.csv create mode 100644 src/ui/test_instructions_reminder/__init__.py create mode 100644 src/ui/test_instructions_reminder/test_instructions_reminder.py create mode 100644 src/ui/test_instructions_reminder/test_instructions_reminder.ui diff --git a/config/machine_settings/st-ten-5.ini b/config/machine_settings/st-ten-5.ini index 228f784..511d714 100644 --- a/config/machine_settings/st-ten-5.ini +++ b/config/machine_settings/st-ten-5.ini @@ -90,10 +90,13 @@ filling_time: 15 settling_time: 10 settling_pressure_min_percent: 5 settling_pressure_max_percent: 5 -test_time: 10 -test_pressure_qneg: 10 test_pressure: 5000 -test_pressure_qpos: 5 +test_time: 10 +test_pressure_qpos: 7 +test_pressure_qneg: 10 +test_pressure_tt_qpos: 0 # Q+ Upper test leak limit (tube-tube) +test_pressure_tt_qneg: 5 # Q- Lower test leak limit (tube-tube) + flush_time: 1 flush_pressure: 100 relay_config: 1 \ No newline at end of file diff --git a/src/components/archive_synchronizer.py b/src/components/archive_synchronizer.py index 1b34baf..9bb7cbc 100644 --- a/src/components/archive_synchronizer.py +++ b/src/components/archive_synchronizer.py @@ -43,6 +43,8 @@ class ArchiveSynchronizer(Component): record.archived = self.remote_archive(record) is True if record.uploaded is not True: record.uploaded = self.remote_store(record) is True + else: + self.log.info("simulated archive synchronizer cycle") record.save() if self.hold_time > 0: QThread.msleep(self.hold_time) diff --git a/src/test/csv_import/Tabella_e_daily.csv b/src/test/csv_import/Tabella_e_daily.csv index e62e5af..560c7dd 100644 --- a/src/test/csv_import/Tabella_e_daily.csv +++ b/src/test/csv_import/Tabella_e_daily.csv @@ -1,191 +1,191 @@ -codice_ricetta,Priorita,etichette_supplementari,Numero nastri (N),Numero sensori anello (SA),Numero sensori presenza (SP) -5803034806,1,,,, -5803037204,1,,,, -5803037206,1,,,, -5803037207,1,,,, -5803048121,1,,,, -5803048122,1,,,, -5803048123,1,,,, -5803048125,1,RM2,,, -5803048126,1,MI2,,, -5803048127,1,"MI1,MI2",,, -5803048128,1,"RM1,RM2",,, -5803048131,1,"MI1,MI2",,, -5803048132,1,"RM1,RM2",,, -5803098374,1,,,, -5803098375,1,,,, -5803119920,1,,,, -5803119921,1,,,, -5803119922,1,,,, -5803119923,1,,,, -5803119924,1,,,, -5803119925,1,,,, -5803119926,1,,,, -5803119927,1,,,, -5802850925,1,"RM1,MI1",3,2,2 -5802850926,1,,,, -5802850929,1,,4,3,1 -5802850932,1,,,, -5802850933,1,,,, -5802850941,1,,,, -5802963590,1,,,, -5802963591,1,RB1,,, -5802963593,1,,,, -5802963597,1,,,, -5802963598,1,MB1,,, -5802963599,1,,,, -5802963600,1,,,, -5802963679,1,,,, -5802963681,1,,,, -5802963683,1,,,, -5802963684,1,,,, -5802963685,1,,,, -5803025107,1,"MI1,MI2",,, -5803025111,1,"MB1,MB2",,, -5803025112,1,"RB1,RB2",,, -5803025113,1,"MI1,MI2",,, -5803025114,1,"RM1,RM2",,, -5803025116,1,"MI1,MI2",,, -5803025117,1,"RM1,RM2",,, -5803025127,1,"MI1,MI2",,, -5803025130,1,,,, -5803025131,1,,,, -5803025134,1,,,, -5803025135,1,,,, -5803025136,1,,,, -5803025137,1,,,, -5803033719,1,"MI1,MI2",,, -5803034025,1,"RM1,RM2",,, -5803034029,1,,,, -5803034807,1,"RM1,RM2",2,1, -5803036737,1,,,, -5803041432,1,,,, -5803041433,1,,,, -5802850935,1,,,, -5802850936,1,,,, -5803025108,1,"RM1,RM2",,, -5803025109,1,MI2,,, -5803025110,1,RM2,,, -5803025115,1,MB2,,, -5803025118,1,RB2,,, -5803025132,1,,,, -5803025133,1,,,, -5803033717,1,MI1,,, -5803034002,1,,,, -5803034005,1,,,, -5803034011,1,,,, -5803034015,1,RM1,,, -5803034017,1,MB2,,, -5803034020,1,,,, -5803034021,1,,,, -5803034022,1,,,, -5803034026,1,"RB1,RB2",,, -5803034027,1,MB2,,, -5803034028,1,RB2,,, -5803034770,1,,,, -5803034771,1,,,, -5803034772,1,"MB1,MB2",,, -5803036730,1,RB2,,, -5803036731,1,"RM1,RM2",,, -5803036732,1,MI2,,, -5803036733,1,RM2,,, -5803036734,1,MB2,,, -5803036735,1,RB2,,, -5803036741,1,MI1,,, -5803036742,1,RM1,,, -5803036743,1,MI1,,, -5803036744,1,RM1,,, -5803036746,1,RB1,,, -5803036747,1,MB1,,, -5803036751,1,,,, -5803036753,1,,,, -5803041434,1,MB1,,, -5803041435,1,RB1,,, -5803048129,1,MI2,,, -5803048130,1,RM2,,, -5803041436,2,RM2,,, -5803041437,2,MI2,,, -5803036748,2,MI2,,, -5803036749,2,RM2,,, -5803034810,2,MI1,,, -5803034811,2,RM1,,, -5803101533,2,"RM1,RM2",,, -5803101535,2,"MI1,MI2",,, -5803101537,2,RM1,,, -5803101538,2,MI1,,, -5803108304,2,,,, -5803108310,2,,,, -5803101534,2,RM2,,, -5803101536,2,MI2,,, -5803033718,2,,,, -5803034812,2,,,, -5803034813,2,,,, -5803108305,2,,,, -5803108311,2,,,, -5803007806,2,,,, -5803007807,2,,,, -5803007808,2,,,, -5803034023,2,RM1,,, -5803034024,2,MI1,,, -5803101541,2,RM1,,, -5803101542,2,MI1,,, -5803034778,2,MB2,,, -5803034780,2,RB2,,, -5803037200,2,RM1,,, -5803037201,2,MI1,,, -5803104802,2,,,, -5803104803,2,,,, -5803104804,2,,,, -5803104806,2,,,, -5803104807,2,,,, -5803104808,2,,,, -5803025103,2,MB2,,, -5803025105,2,RB2,,, -5802815391,2,,,, -5802815400,2,,,, -5803047088,2,MB2,,, -5803047079,2,MB2,,, -5803047080,2,RB2,,, -5803047095,2,MB2,,, -5803047096,2,RB2,,, -5803034808,2,"MI1,MI2",,, -5803034809,2,"RM1,RM2",,, -5803108365,2,,,, -5803108368,2,,,, -5803034007,2,,,, -5803034009,2,,,, -5803037202,2,,,, -5803037203,2,,,, -5803108366,2,,,, -5803108369,2,,,, -5803025123,2,"MI1,MI2",,, -5803025124,2,"RM1,RM2",,, -5803025125,2,MI1,,, -5803025126,2,RM1,,, -5803034773,2,RM1,,, -5803033716,2,RM1,,, -5803034013,2,MI1,,, -5803025100,2,"MI1,MI2",,, -5803025101,2,"RB1,RB2",,, -5803047093,2,"MB1,MB2",,, -5803025099,2,"MB1,MB2",,, -5803025102,2,"RM1,RM2",,, -5803025104,2,"MI1,MI2",,, -5803025106,2,"RM1,RM2",,, -5803047087,2,"MI1,MI2",,, -5803047090,2,"RM1,RM2",,, -5803047092,2,"MI1,MI2",,, -5803025128,2,,,, -5803025129,2,,,, -5803047075,2,RM2,,, -5803047076,2,MI2,,, -5803034776,2,,,, -5803047073,2,RM1,,, -5803047074,2,MI1,,, -5803034774,2,MI1,,, -5803036739,2,MI1,,, -5803036740,2,RM1,,, -5803047098,2,,,, -5803047099,2,,,, -5802815398,2,,,, -5803047091,2,RB2,,, +codice_ricetta,Priorita,etichette_supplementari +5803034806,1, +5803037204,1, +5803037206,1, +5803037207,1, +5803048121,1, +5803048122,1, +5803048123,1, +5803048125,1,RM2 +5803048126,1,MI2 +5803048127,1,"MI1,MI2" +5803048128,1,"RM1,RM2" +5803048131,1,"MI1,MI2" +5803048132,1,"RM1,RM2" +5803098374,1, +5803098375,1, +5803119920,1, +5803119921,1, +5803119922,1, +5803119923,1, +5803119924,1, +5803119925,1, +5803119926,1, +5803119927,1, +5802850925,1,"RM1,MI1" +5802850926,1, +5802850929,1, +5802850932,1, +5802850933,1, +5802850941,1, +5802963590,1, +5802963591,1,RB1 +5802963593,1, +5802963597,1, +5802963598,1,MB1 +5802963599,1, +5802963600,1, +5802963679,1, +5802963681,1, +5802963683,1, +5802963684,1, +5802963685,1, +5803025107,1,"MI1,MI2" +5803025111,1,"MB1,MB2" +5803025112,1,"RB1,RB2" +5803025113,1,"MI1,MI2" +5803025114,1,"RM1,RM2" +5803025116,1,"MI1,MI2" +5803025117,1,"RM1,RM2" +5803025127,1,"MI1,MI2" +5803025130,1, +5803025131,1, +5803025134,1, +5803025135,1, +5803025136,1, +5803025137,1, +5803033719,1,"MI1,MI2" +5803034025,1,"RM1,RM2" +5803034029,1, +5803034807,1,"RM1,RM2" +5803036737,1, +5803041432,1, +5803041433,1, +5802850935,1, +5802850936,1, +5803025108,1,"RM1,RM2" +5803025109,1,MI2 +5803025110,1,RM2 +5803025115,1,MB2 +5803025118,1,RB2 +5803025132,1, +5803025133,1, +5803033717,1,MI1 +5803034002,1, +5803034005,1, +5803034011,1, +5803034015,1,RM1 +5803034017,1,MB2 +5803034020,1, +5803034021,1, +5803034022,1, +5803034026,1,"RB1,RB2" +5803034027,1,MB2 +5803034028,1,RB2 +5803034770,1, +5803034771,1, +5803034772,1,"MB1,MB2" +5803036730,1,RB2 +5803036731,1,"RM1,RM2" +5803036732,1,MI2 +5803036733,1,RM2 +5803036734,1,MB2 +5803036735,1,RB2 +5803036741,1,MI1 +5803036742,1,RM1 +5803036743,1,MI1 +5803036744,1,RM1 +5803036746,1,RB1 +5803036747,1,MB1 +5803036751,1, +5803036753,1, +5803041434,1,MB1 +5803041435,1,RB1 +5803048129,1,MI2 +5803048130,1,RM2 +5803041436,2,RM2 +5803041437,2,MI2 +5803036748,2,MI2 +5803036749,2,RM2 +5803034810,2,MI1 +5803034811,2,RM1 +5803101533,2,"RM1,RM2" +5803101535,2,"MI1,MI2" +5803101537,2,RM1 +5803101538,2,MI1 +5803108304,2, +5803108310,2, +5803101534,2,RM2 +5803101536,2,MI2 +5803033718,2, +5803034812,2, +5803034813,2, +5803108305,2, +5803108311,2, +5803007806,2, +5803007807,2, +5803007808,2, +5803034023,2,RM1 +5803034024,2,MI1 +5803101541,2,RM1 +5803101542,2,MI1 +5803034778,2,MB2 +5803034780,2,RB2 +5803037200,2,RM1 +5803037201,2,MI1 +5803104802,2, +5803104803,2, +5803104804,2, +5803104806,2, +5803104807,2, +5803104808,2, +5803025103,2,MB2 +5803025105,2,RB2 +5802815391,2, +5802815400,2, +5803047088,2,MB2 +5803047079,2,MB2 +5803047080,2,RB2 +5803047095,2,MB2 +5803047096,2,RB2 +5803034808,2,"MI1,MI2" +5803034809,2,"RM1,RM2" +5803108365,2, +5803108368,2, +5803034007,2, +5803034009,2, +5803037202,2, +5803037203,2, +5803108366,2, +5803108369,2, +5803025123,2,"MI1,MI2" +5803025124,2,"RM1,RM2" +5803025125,2,MI1 +5803025126,2,RM1 +5803034773,2,RM1 +5803033716,2,RM1 +5803034013,2,MI1 +5803025100,2,"MI1,MI2" +5803025101,2,"RB1,RB2" +5803047093,2,"MB1,MB2" +5803025099,2,"MB1,MB2" +5803025102,2,"RM1,RM2" +5803025104,2,"MI1,MI2" +5803025106,2,"RM1,RM2" +5803047087,2,"MI1,MI2" +5803047090,2,"RM1,RM2" +5803047092,2,"MI1,MI2" +5803025128,2, +5803025129,2, +5803047075,2,RM2 +5803047076,2,MI2 +5803034776,2, +5803047073,2,RM1 +5803047074,2,MI1 +5803034774,2,MI1 +5803036739,2,MI1 +5803036740,2,RM1 +5803047098,2, +5803047099,2, +5802815398,2, +5803047091,2,RB2 diff --git a/src/test/csv_import/Tabella_e_dailyP345.csv b/src/test/csv_import/Tabella_e_dailyP345.csv new file mode 100644 index 0000000..10292cd --- /dev/null +++ b/src/test/csv_import/Tabella_e_dailyP345.csv @@ -0,0 +1,48 @@ +"codice_ricetta","priorita","descrizione","etichette_supplementari" +5803223729,3,"priorita 3","MI2" +5803223730,3,"priorita 3","MI1,MI2" +5803223731,3,"priorita 3","MB2" +5803223732,3,"priorita 3","RM1,RM2" +5803223733,3,"priorita 3","RM2" +5803223734,3,"priorita 3","RB2" +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","RM2" +5803223747,3,"priorita 3","MI2" +5803223748,3,"priorita 3","RM1,RM2" +5803223749,3,"priorita 3","MI1,MI2" +5803223750,3,"priorita 3","RB2" +5803223751,3,"priorita 3","MB2" +5803223752,3,"priorita 3","RM2" +5803223753,3,"priorita 3","MI2" +5803120372,3,"priorita 3","RB2" +5803120373,3,"priorita 3","MB2" +5803120374,3,"priorita 3", +5803120375,3,"priorita 3", +5803101543,3,"priorita 3","MI1" +5803101544,3,"priorita 3","RM1" +5803101545,3,"priorita 3","RM1,RM2" +5803101546,3,"priorita 3","MI1,MI2" +5803101547,3,"priorita 3", +5803223754,3,"priorita 3", +5803223755,3,"priorita 3", +5803120371,3,"priorita 3", +5803228584,3,"priorita 3", +5803228585,3,"priorita 3", +5803236684,4,"priorita 4", +5803236685,4,"priorita 4", +5803229237,5,"priorita 5","RB1" +5803229239,5,"priorita 5","MB1" +5803229240,5,"priorita 5","RM2" +5803229242,5,"priorita 5","MI2" +5803229244,5,"priorita 5","RB1,RB2" +5803229245,5,"priorita 5","MB1,MB2" diff --git a/src/ui/__init__.py b/src/ui/__init__.py index e298bad..7b7d869 100644 --- a/src/ui/__init__.py +++ b/src/ui/__init__.py @@ -1,3 +1,5 @@ +from .widget import Widget +from .window import Window from .dialog import Dialog from .about import About from .archive import Archive @@ -37,6 +39,7 @@ from .test_count import Test_Count from .test_count_end import Test_Count_End from .test_fail import Test_Fail from .test_home import Test_Home +from .test_instructions_reminder import Test_Instructions_Reminder from .test_leak import Test_Leak from .test_resistance import Test_Resistance from .test_screws import Test_Screws @@ -44,5 +47,3 @@ from .test_test import Test_Test from .test_vision import Test_Vision from .users_management import Users_Management from .vision_step_editor import Vision_Step_Editor -from .widget import Widget -from .window import Window diff --git a/src/ui/test_instructions_reminder/__init__.py b/src/ui/test_instructions_reminder/__init__.py new file mode 100644 index 0000000..1eb8b6b --- /dev/null +++ b/src/ui/test_instructions_reminder/__init__.py @@ -0,0 +1 @@ +from .test_instructions_reminder import Test_Instructions_Reminder diff --git a/src/ui/test_instructions_reminder/test_instructions_reminder.py b/src/ui/test_instructions_reminder/test_instructions_reminder.py new file mode 100644 index 0000000..2e6153e --- /dev/null +++ b/src/ui/test_instructions_reminder/test_instructions_reminder.py @@ -0,0 +1,78 @@ +import os.path +import sys +import weakref + +from PyQt5 import QtSvg +from PyQt5.QtCore import Qt + +from lib.helpers import timing +from PyQt5.QtCore import QTimer +from PyQt5.QtGui import QKeySequence, QPixmap +from PyQt5.QtWidgets import QShortcut, QApplication, QVBoxLayout + +from lxml import etree + +from ui import Widget + + +class Test_Instructions_Reminder(Widget): + def __init__(self, recipe=None, bench_name="generic"): + super().__init__() + self.bench_name = bench_name + self.recipe=recipe + 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) + self.svg_w.setLayout(self.layout) + self.svg_path=os.path.join("config","instruction_images",self.bench_name,"") + self.timer = QTimer() + self.timer.timeout.connect(self.toggle_icons) + + self.start() + + def start(self, recipe=None, step=None, pieces=None): + + svg_path=f"{self.svg_path}{self.recipe}.svg" + if not os.path.exists(svg_path): + svg_path=f"{self.svg_path}DEFAULT.svg" + 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.timer.start(1000) + def toggle_icons(self): + self.flag = not self.flag + + for elem in self.tape_ids: + if self.flag: + self.show_tape(elem) + else: + self.hide_tape(elem) + + + self.show_svg() + + + def show_icon(self,id): + id.set("display", "inline") + + def hide_icon(self,id): + id.set("display", "none") + + def show_tape(self,id): + 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): + id.set("display", "none") + + def show_svg(self): + self.svg_str = etree.tostring(self.svg_root) + self.svg_widget.load(self.svg_str) + QApplication.processEvents() diff --git a/src/ui/test_instructions_reminder/test_instructions_reminder.ui b/src/ui/test_instructions_reminder/test_instructions_reminder.ui new file mode 100644 index 0000000..7de90ab --- /dev/null +++ b/src/ui/test_instructions_reminder/test_instructions_reminder.ui @@ -0,0 +1,74 @@ + + + Test_Warning_Img + + + + 0 + 0 + 1224 + 922 + + + + Test Count End + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + 20 + 75 + true + + + + Istruzione operativa + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + + + 1200 + 700 + + + + + 1200 + 700 + + + + + + + + + + + + diff --git a/src/ui/test_leak/test_leak.py b/src/ui/test_leak/test_leak.py index b06a9fe..06e822a 100644 --- a/src/ui/test_leak/test_leak.py +++ b/src/ui/test_leak/test_leak.py @@ -5,8 +5,8 @@ import weakref from PyQt5.QtWidgets import QMessageBox, QDialog, QApplication from ui import Dialog +from ui.test_instructions_reminder import Test_Instructions_Reminder 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): @@ -20,7 +20,7 @@ class Test_Leak(Test_Test): def show_instruction(self): dialog=Dialog() - dialog.setCentralWidget(self.parent.cycle_available_steps["instruction"]) + dialog.setCentralWidget(Test_Instructions_Reminder(recipe=self.parent.recipe,bench_name=self.parent.config.machine_id)) dialog.show() def start_test(self):