added action for tag_write

This commit is contained in:
edo-neo 2025-02-17 10:01:56 +01:00
parent d5d4d654e8
commit 58214b315a
4 changed files with 22 additions and 31 deletions

View File

@ -209,6 +209,7 @@ try:
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)
self.main_window.tag_a.triggered.connect(self.tag_write)
self.main_window.diagnostics_a.triggered.connect(
lambda checked, selfie=weakref.ref(self): selfie().main_window.open_dialog(Diagnostics(selfie())))
if "--users-management" in sys.argv:
@ -284,6 +285,11 @@ try:
def reprint_label(self):
self.main_window.centralWidget().reprint_label()
def tag_write(self):
if isinstance(self.main_window.centralWidget().centralWidget.widget, Barcode_Recipe_Selection):
barcode_data = self.main_window.centralWidget().centralWidget.widget.barcode_input_l.toPlainText().strip()
self.main_window.centralWidget().centralWidget.widget.tag_write(barcode_data)
@pyqtSlot(str)
def load_recipe_from_rfid(self, data):
self.tag_loaded_recipe = data

View File

@ -37,7 +37,6 @@ class Barcode_Recipe_Selection(Test_Test):
self.status_palettes["warning"].setColor(QPalette.Base, QColor(255, 165, 0))
self.status_palettes[""].setColor(QPalette.Base, QColor(255, 255, 0))
self.tag_b.clicked.connect(self.open_tag_window)
self.recipe_selection_b.clicked.connect(self.parent.set_recipe_mode_table)
self.barcode_input_l.setFocus()
@ -54,12 +53,7 @@ class Barcode_Recipe_Selection(Test_Test):
self.ok_timer.setSingleShot(True)
self.ok_timer.timeout.connect(self.set_recipe)
session= Users.get_session()
if session.is_admin:
self.tag_b.setVisible(True)
else:
self.tag_b.setVisible(False)
def start(self, recipe=None, step=None, pieces=None):
@ -123,14 +117,11 @@ class Barcode_Recipe_Selection(Test_Test):
else:
self.parent_assembly_widget().set_text("SCANSIONARE BARCODE SELEZIONE RICETTA")
def open_tag_window(self):
self.parent_assembly_widget().set_text(
"SCRITTURA TAG NFC ",bg_color=" yellow")
tag_data = self.barcode_input_l.toPlainText().strip()
def tag_write(self, data_to_write=None):
self.parent_assembly_widget().set_text("SCRITTURA TAG NFC ", bg_color=" yellow")
tag_data = data_to_write if data_to_write else self.barcode_input_l.toPlainText().strip()
if not tag_data:
QMessageBox.warning(self, "Warning", "Il campo di input è vuoto. Scansiona un QR code o un tag NFC per conTINUARE")
QMessageBox.warning(self, "Warning", "Il campo di input è vuoto. Scansiona un QR code o un tag NFC per continuare")
return
if self.parent.components["fixture_id"].current_data:

View File

@ -147,24 +147,6 @@
</property>
</spacer>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="tag_b">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>11</pointsize>
</font>
</property>
<property name="text">
<string>SCRIVI TAG NFC</string>
</property>
</widget>
</item>
<item row="1" column="2">
<spacer name="horizontalSpacer_4">
<property name="orientation">

View File

@ -67,6 +67,8 @@
<addaction name="logout_a"/>
<addaction name="table_selection_a"/>
<addaction name="barcode_selection_a"/>
<addaction name="tag_a"/>
<addaction name="actionCalibra_Taglio"/>
<addaction name="ristampa_etichetta_a"/>
<addaction name="separator"/>
<addaction name="separator"/>
@ -146,6 +148,16 @@
<string>Aggiornamento</string>
</property>
</action>
<action name="tag_a">
<property name="text">
<string>Scrivi Tag nfc</string>
</property>
</action>
<action name="actionCalibra_Taglio">
<property name="text">
<string>Calibra Taglio</string>
</property>
</action>
</widget>
<resources/>
<connections/>