From 941e3ba764e5575243eef5745ffe9d7b230e0c0d Mon Sep 17 00:00:00 2001 From: eduardo Date: Thu, 23 May 2024 15:08:22 +0200 Subject: [PATCH] supporto assemblati whip --- src/ui/test_barcodes/test_barcodes.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/ui/test_barcodes/test_barcodes.py b/src/ui/test_barcodes/test_barcodes.py index 39d29cf..889b623 100644 --- a/src/ui/test_barcodes/test_barcodes.py +++ b/src/ui/test_barcodes/test_barcodes.py @@ -12,6 +12,7 @@ class Test_Barcodes(Test_Test): def __init__(self, components=None, recipe=None, step=None, pieces=None, run_once=False, reset_on_start=True, enable_override=False): super().__init__(components=components, recipe=recipe, step=step, pieces=pieces, run_once=run_once, reset_on_start=reset_on_start, enable_override=enable_override) self.current_step_barcode_name = None + self.start_counter = 0 self.barcodes_spec = { "serial": self.check_serial_barcode, "barcode_input_2": self.check_serial_barcode, @@ -29,11 +30,16 @@ class Test_Barcodes(Test_Test): def start(self, recipe=None, step=None, pieces=None): show = super().start(recipe=recipe, step=step, pieces=pieces) + self.start_counter += 1 + npieces = self.step.spec.get("n_pieces") + npieces = int(npieces) if npieces is not None else 0 + if self.start_counter > npieces + 1: # If start_counter exceeds npieces + 1 + self.start_counter = 1 + display_str = "{}/{}".format(self.start_counter, npieces + 1) + self.counter_l.setText(display_str) if show is False: return show self.current_step_barcode_name = self.step.spec.get('barcode_name') - self.counter_l.setText(self.step.spec.get("n_pieces")) - self.expected_barcode.setText(self.step.spec.get(self.current_step_barcode_name)) self.visualize() self.barcodes_le.setPalette(self.status_palettes[None])