diff --git a/src/ui/test_instructions/test_instructions.py b/src/ui/test_instructions/test_instructions.py index cba09ae..82c107e 100644 --- a/src/ui/test_instructions/test_instructions.py +++ b/src/ui/test_instructions/test_instructions.py @@ -62,27 +62,33 @@ class Test_Instructions(Test_Test): return show def toggle_icons(self): - self.flag = not self.flag + default_image_path = os.path.join("config", "instruction_images", self.config["machine"]["instruction_folder"], + "DEFAULT.svg") - for elem in self.tape_ids: - if self.flag: - self.show_tape(elem) - else: - self.hide_tape(elem) + if self.svg_path is None or self.svg_path == default_image_path: + if hasattr(self, + "print_b") and not self.done: # Verifica se il pulsante di stampa è abilitato e non è stato premuto + self.flag = not self.flag - for elem in self.monitored_ids: - sensor_index = int(elem.attrib['id'].split("_")[1]) - 3 - if self.inputs[sensor_index]: - self.show_ok(elem) - self.show_icon(elem) - else: - self.show_ko(elem) - if self.flag: - self.show_icon(elem) - else: - self.hide_icon(elem) + for elem in self.tape_ids: + if self.flag: + self.show_tape(elem) + else: + self.hide_tape(elem) - self.show_svg() + for elem in self.monitored_ids: + sensor_index = int(elem.attrib['id'].split("_")[1]) - 3 + if self.inputs[sensor_index]: + self.show_ok(elem) + self.show_icon(elem) + else: + self.show_ko(elem) + if self.flag: + self.show_icon(elem) + else: + self.hide_icon(elem) + + self.show_svg() def print_button(self): super().get([{