instructions wip

This commit is contained in:
germano 2023-01-12 22:15:29 +01:00
parent f7bf61aada
commit 306e774c26
12 changed files with 181 additions and 6 deletions

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View File

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 47 KiB

View File

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View File

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

@ -1,2 +1,3 @@
#!/bin/bash
venv/Lib/site-packages/qt5_applications/Qt/bin/designer
.\venv\Lib\site-packages\qt5_applications\Qt\bin\designer.exe

View File

@ -60,12 +60,12 @@
<item row="1" column="0">
<widget class="QLabel" name="label_32">
<property name="text">
<string>Immagine warning</string>
<string>Immagine warning iniziale</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="warning_img_le"/>
<item row="1" column="2">
<widget class="QLineEdit" name="warning_img_le_2"/>
</item>
</layout>
</widget>

View File

@ -17,6 +17,7 @@ from ui.test_connector import Test_Connector
from ui.test_count import Test_Count
from ui.test_count_end import Test_Count_End
from ui.test_warning_img import Test_Warning_Img
from ui.test_instructions import Test_Instructions
from ui.test_fail import Test_Fail
from ui.test_leak import Test_Leak
from ui.test_resistance import Test_Resistance
@ -84,6 +85,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": Test_Assembly(img_path=None, text=None, widget=Test_Leak(components=self.components, recipe=self.recipe, step=self.step, pieces=self.pieces)),
"instructions": Test_Assembly(img_path=None, text=u"ESEGUIRE LE OPERAZIONI INDICATE IN FIGURA", widget=Test_Instructions(components=self.components, recipe=self.recipe, step=self.step,run_once=True)),
"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)),
"screws": Test_Assembly(img_path=None, text=u"AVVITARE TUTE LE VITI COME INDICATO", widget=Test_Screws(components=self.components, recipe=self.recipe, step=self.step, pieces=self.pieces)),
@ -270,8 +272,6 @@ class Test(Widget):
self.archived.label = compiled_label
self.archived.save()
self.next_timer.start(2000)
# elif self.step.type == "fail":
# self.next_timer.start(2000)
elif self.step.type == "wait":
self.next_timer.start(2000)
# UPDATE PIECES DISPLAY
@ -287,6 +287,7 @@ class Test(Widget):
skip = set()
print_found = False
count_found = False
# create step sequence list
for i, step in enumerate(steps):
if i in skip:
continue
@ -295,6 +296,9 @@ class Test(Widget):
if step.spec["warning_img"]:
steps.insert(i,Steps(type="warning_img", spec={"warning_img":step.spec["warning_img"]}))
skip.add(i + 1)
if step.spec["instructions"]:
steps.insert(i, Steps(type="instructions", spec={"instruction_img": step.spec["instruction_img"]}))
skip.add(i + 1)
if step.type == "resistance":
steps.insert(i + 1, Steps(type="resistance", spec={
"scale": 500,

View File

@ -0,0 +1 @@
from .test_instructions import Test_Instructions

View File

@ -0,0 +1,59 @@
import sys
import weakref
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
from ui.test_test import Test_Test
class Test_Instructions(Test_Test):
def __init__(self, components=None, recipe=None, step=None, run_once=False, reset_on_start=False, enable_override=False,bench_name="generic"):
super().__init__(components=components, recipe=recipe, step=step, run_once=run_once, reset_on_start=reset_on_start, enable_override=enable_override)
self.bench_name = bench_name
def start(self, recipe=None, step=None, pieces=None):
show = super().start(recipe=recipe, step=step)
if step is not None:
img_path=f"config/instruction_images/{self.bench_name}/{step.spec['warning_img']}.png"
self.continue_b.clicked.connect(lambda checked, self=weakref.ref(self): self().get(0))
self.img = QPixmap(str(img_path))
self.img_l.setPixmap(self.img)
return show
def get(self, data=None, override=False):
if self.done: # avoid proccessing if completed
return
# if data is None:
# data = self.amount_sb.value()
if data is None:
super().get(None, override=override)
return
result = data
ok = True
super().get([{
"time": timing(),
"results": {
"ok": ok,
"result": result,
"data": data,
},
}], override=override, fail=ok is False, skip_delay=True)
def set_done(self):
self.done=True
self.done_ok=True
def stop(self):
#self.done=True
#self.done_ok = True
super().stop()
def reset(self):
super().reset()

View File

@ -0,0 +1,110 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Test_Warning_Img</class>
<widget class="QWidget" name="Test_Warning_Img">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>839</width>
<height>746</height>
</rect>
</property>
<property name="windowTitle">
<string>Test Count End</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>20</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="title">
<string>Istruzione operativa</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="3" column="0" colspan="2">
<widget class="QPushButton" name="continue_b">
<property name="font">
<font>
<pointsize>20</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">background-color:rgb(85, 255, 127);</string>
</property>
<property name="text">
<string>ok</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="img_l">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>800</width>
<height>600</height>
</size>
</property>
<property name="text">
<string>Immagine istruzione</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="13" column="0">
<widget class="QPushButton" name="override_b">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>FORZA ACCETTAZIONE</string>
</property>
</widget>
</item>
</layout>
</widget>
<tabstops>
<tabstop>override_b</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>

View File

@ -19,7 +19,7 @@ class Test_Warning_Img(Test_Test):
show = super().start(recipe=recipe, step=step)
if step is not None:
img_path=f"config/instruction_images/{self.bench_name}/{step.spec['warning_img']}.png"
img_path=f"config/warning_images/{self.bench_name}/{step.spec['warning_img']}.png"
self.continue_b.clicked.connect(lambda checked, self=weakref.ref(self): self().get(0))
self.img = QPixmap(str(img_path))
self.img_l.setPixmap(self.img)