tentative fix label glitch + speedup
This commit is contained in:
parent
71300177ff
commit
999c32734e
@ -1 +0,0 @@
|
|||||||
from .rfid_recipe_selection import RFID_Recipe_Selection
|
|
||||||
@ -1,85 +0,0 @@
|
|||||||
import sys
|
|
||||||
|
|
||||||
import peewee
|
|
||||||
from PyQt5 import Qt
|
|
||||||
|
|
||||||
from lib.helpers import timing
|
|
||||||
from PyQt5.QtCore import Qt, QTimer, QThread
|
|
||||||
from PyQt5.QtGui import QKeySequence, QPixmap, QPalette, QColor
|
|
||||||
from PyQt5.QtWidgets import QShortcut, QApplication
|
|
||||||
from ui.widget import Widget
|
|
||||||
from lib import db
|
|
||||||
from lib.db.models import Recipes
|
|
||||||
|
|
||||||
class RFID(Widget):
|
|
||||||
def __init__(self, parent):
|
|
||||||
super().__init__()
|
|
||||||
self.parent=parent
|
|
||||||
self.recipe_db_model=Recipes
|
|
||||||
self.status_palettes = {
|
|
||||||
True: QPalette(),
|
|
||||||
"": QPalette(),
|
|
||||||
"warning": QPalette(),
|
|
||||||
False: QPalette(),
|
|
||||||
None: QPalette(),
|
|
||||||
}
|
|
||||||
self.status_palettes[True].setColor(QPalette.Base, Qt.green)
|
|
||||||
self.status_palettes[False].setColor(QPalette.Base, Qt.red)
|
|
||||||
self.status_palettes["warning"].setColor(QPalette.Base, QColor(255, 165, 0))
|
|
||||||
self.status_palettes[""].setColor(QPalette.Base, QColor(255, 255, 0))
|
|
||||||
|
|
||||||
self.delay_timer = QTimer()
|
|
||||||
self.delay_timer.setSingleShot(True)
|
|
||||||
self.delay_timer.timeout.connect(self.reset_display)
|
|
||||||
|
|
||||||
self.ok_timer = QTimer()
|
|
||||||
self.ok_timer.setSingleShot(True)
|
|
||||||
self.ok_timer.timeout.connect(self.set_recipe)
|
|
||||||
|
|
||||||
def start(self, recipe=None, step=None, pieces=None):
|
|
||||||
|
|
||||||
self.rfid_input_l.setPalette(self.status_palettes[None])
|
|
||||||
self.rfid_input_l.setPlainText("")
|
|
||||||
|
|
||||||
def get(self, data=None, override=False):
|
|
||||||
if not len(data):
|
|
||||||
data = None
|
|
||||||
if data is None:
|
|
||||||
return
|
|
||||||
else:
|
|
||||||
lines = data
|
|
||||||
if lines[0]=="ERRECINQUE RFID":
|
|
||||||
# RECIPE CODE FOUND
|
|
||||||
self.recipe=lines[1]
|
|
||||||
self.rfid_input_l.setPalette(self.status_palettes[True])
|
|
||||||
self.ok_timer.start(2000)
|
|
||||||
|
|
||||||
else:
|
|
||||||
# RECIPE CODE NOT FOUND
|
|
||||||
self.rfid_input_l.setPalette(self.status_palettes[False])
|
|
||||||
self.instruction_text("FORMATO RFID DIMA NON VALIDO", "red")
|
|
||||||
self.delay_timer.start(3000)
|
|
||||||
|
|
||||||
# LOOKUP RECIPE
|
|
||||||
|
|
||||||
def set_recipe(self):
|
|
||||||
try:
|
|
||||||
recipe = self.recipe_db_model.get_by_id(self.recipe)
|
|
||||||
self.parent.set_recipe(recipe)
|
|
||||||
except peewee.DoesNotExist:
|
|
||||||
self.rfid_input_l.setPalette(self.status_palettes[False])
|
|
||||||
self.instruction_text("RICETTA NON TROVATA","red")
|
|
||||||
self.delay_timer.start(3000)
|
|
||||||
|
|
||||||
|
|
||||||
def reset_display(self):
|
|
||||||
self.rfid_input_l.setFocus()
|
|
||||||
self.rfid_input_l.setPlainText("")
|
|
||||||
self.rfid_input_l.setPalette(self.status_palettes[""])
|
|
||||||
self.instruction_text("INSERIRE IL CONNETTORE DI COLLEGAMENTO DIMA PER SELEZIONARE AUTOMATICAMENTE LA RICETTA DI COLLAUDO")
|
|
||||||
|
|
||||||
def instruction_text(self,text,color=None):
|
|
||||||
if getattr(self.parent.centralWidget, "set_text"):
|
|
||||||
self.parent.centralWidget.set_text(text, color=color)
|
|
||||||
|
|
||||||
|
|
||||||
@ -1,95 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>Test_Connector</class>
|
|
||||||
<widget class="QWidget" name="Test_Connector">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>1445</width>
|
|
||||||
<height>793</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>Test Connector</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="2" column="0" alignment="Qt::AlignHCenter">
|
|
||||||
<widget class="QLabel" name="state_l">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>200</width>
|
|
||||||
<height>200</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<pointsize>12</pointsize>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="0" alignment="Qt::AlignHCenter">
|
|
||||||
<widget class="QPlainTextEdit" name="barcode_input_l">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>600</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>600</width>
|
|
||||||
<height>200</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<pointsize>20</pointsize>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="plainText">
|
|
||||||
<string>123
|
|
||||||
456
|
|
||||||
abc</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="0" alignment="Qt::AlignHCenter">
|
|
||||||
<widget class="QPushButton" name="recipe_selection_b">
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<pointsize>20</pointsize>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>TORNA ALLA TABELLA RICETTE</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<resources/>
|
|
||||||
<connections/>
|
|
||||||
</ui>
|
|
||||||
@ -317,14 +317,14 @@ class Test(Widget):
|
|||||||
self.next_timer.start(0)
|
self.next_timer.start(0)
|
||||||
if self.step.type == "done":
|
if self.step.type == "done":
|
||||||
self.archived = self.done()
|
self.archived = self.done()
|
||||||
self.next_timer.start(2000)
|
self.next_timer.start(1000)
|
||||||
elif self.step.type == "print":
|
elif self.step.type == "print":
|
||||||
compiled_label = self.print(self.archived, self.step.spec.get("template", "EtichettaR5"))
|
compiled_label = self.print(self.archived, self.step.spec.get("template", "EtichettaR5"))
|
||||||
self.archived.label = compiled_label
|
self.archived.label = compiled_label
|
||||||
self.archived.save()
|
self.archived.save()
|
||||||
self.next_timer.start(2000)
|
self.next_timer.start(1000)
|
||||||
elif self.step.type == "wait":
|
elif self.step.type == "wait":
|
||||||
self.next_timer.start(2000)
|
self.next_timer.start(1000)
|
||||||
# UPDATE COUNT DISPLAY
|
# UPDATE COUNT DISPLAY
|
||||||
self.updaate_count_display()
|
self.updaate_count_display()
|
||||||
|
|
||||||
|
|||||||
@ -30,6 +30,10 @@ class Test_Leak(Test_Test):
|
|||||||
dialog.setCentralWidget(Test_Instructions_Reminder(recipe=self.parent.recipe,bench_name=self.parent.config.machine_id))
|
dialog.setCentralWidget(Test_Instructions_Reminder(recipe=self.parent.recipe,bench_name=self.parent.config.machine_id))
|
||||||
dialog.show()
|
dialog.show()
|
||||||
|
|
||||||
|
def reset(self):
|
||||||
|
self.components["tecna_t3"].stop_test()
|
||||||
|
super.reset()
|
||||||
|
|
||||||
def stop_test(self):
|
def stop_test(self):
|
||||||
self.components["tecna_t3"].stop_test()
|
self.components["tecna_t3"].stop_test()
|
||||||
self.display_text(text="PROVA INTERROTTA", bg_color="yellow")
|
self.display_text(text="PROVA INTERROTTA", bg_color="yellow")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user