From 58214b315ac79edf8dd8f58fe6135baec8998d3e Mon Sep 17 00:00:00 2001 From: edo-neo Date: Mon, 17 Feb 2025 10:01:56 +0100 Subject: [PATCH] added action for tag_write --- src/main.py | 6 ++++++ .../barcode_recipe_selection.py | 17 ++++------------- .../barcode_recipe_selection.ui | 18 ------------------ src/ui/main_window/main_window.ui | 12 ++++++++++++ 4 files changed, 22 insertions(+), 31 deletions(-) diff --git a/src/main.py b/src/main.py index cbd2a54..b400965 100644 --- a/src/main.py +++ b/src/main.py @@ -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 diff --git a/src/ui/barcode_recipe_selection/barcode_recipe_selection.py b/src/ui/barcode_recipe_selection/barcode_recipe_selection.py index 16540cb..e209b25 100644 --- a/src/ui/barcode_recipe_selection/barcode_recipe_selection.py +++ b/src/ui/barcode_recipe_selection/barcode_recipe_selection.py @@ -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: diff --git a/src/ui/barcode_recipe_selection/barcode_recipe_selection.ui b/src/ui/barcode_recipe_selection/barcode_recipe_selection.ui index 85b0c3c..83ba00c 100644 --- a/src/ui/barcode_recipe_selection/barcode_recipe_selection.ui +++ b/src/ui/barcode_recipe_selection/barcode_recipe_selection.ui @@ -147,24 +147,6 @@ - - - - - 0 - 0 - - - - - 11 - - - - SCRIVI TAG NFC - - - diff --git a/src/ui/main_window/main_window.ui b/src/ui/main_window/main_window.ui index b75df9a..6ffe546 100644 --- a/src/ui/main_window/main_window.ui +++ b/src/ui/main_window/main_window.ui @@ -67,6 +67,8 @@ + + @@ -146,6 +148,16 @@ Aggiornamento + + + Scrivi Tag nfc + + + + + Calibra Taglio + +