dev free_fall

This commit is contained in:
edo-neo 2025-10-20 14:43:19 +02:00
parent 95e99e8653
commit 26f3402fe4
3 changed files with 38 additions and 6 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 652 KiB

After

Width:  |  Height:  |  Size: 730 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 730 KiB

View File

@ -209,11 +209,34 @@ class Test_Leak(Test_Test):
else: else:
super().visualize(None, img=self.status_imgs_full[None]) super().visualize(None, img=self.status_imgs_full[None])
else: else:
# Ensure Free Fall mode is disabled for other steps # If the recipe contains a Free Fall test, show the PERVIETÀ image as default even on Leak steps
self._free_fall_mode = False try:
self._free_fall_img_scale = None has_free_fall = any(getattr(s, "step_type", None) == "test_freefall_leak" for s in (self.parent.cycle_steps or []))
self.display_text(text="COLLEGARE GLI ATTACCHI PNEUMATICI E PREMERE START PER INIZIARE LA PROVA TENUTA") except Exception:
super().visualize(None, img=self.status_imgs_full[None]) has_free_fall = False
if has_free_fall:
# Reuse Free Fall mode to benefit from special scaling and image persistence
self._free_fall_mode = True
self._free_fall_img_scale = 1.75
# Keep normal Leak instruction text
self.display_text(text="COLLEGARE GLI ATTACCHI PNEUMATICI E PREMERE START PER INIZIARE LA PROVA TENUTA")
# Load PERVIETÀ image with fallbacks
pervieta_path_candidates = [
"config/warning_images/generic/PERVIETÀ_2.png",
"config/warning_images/generic/PERVIETA_2.png",
"config/warning_images/generic/pervieta_2.png",
]
img_path = next((p for p in pervieta_path_candidates if os.path.exists(p)), None)
if img_path is not None:
super().visualize(None, img=QPixmap(img_path))
else:
super().visualize(None, img=self.status_imgs_full[None])
else:
# Ensure Free Fall mode is disabled for other steps
self._free_fall_mode = False
self._free_fall_img_scale = None
self.display_text(text="COLLEGARE GLI ATTACCHI PNEUMATICI E PREMERE START PER INIZIARE LA PROVA TENUTA")
super().visualize(None, img=self.status_imgs_full[None])
if step.step_type != "test_freefall_leak": if step.step_type != "test_freefall_leak":
self.template_print_l.setVisible(True) self.template_print_l.setVisible(True)
self.template_label.setVisible(True) self.template_label.setVisible(True)
@ -391,7 +414,16 @@ class Test_Leak(Test_Test):
self.stop_b.setEnabled(True) self.stop_b.setEnabled(True)
ok = data.get("results", {}).get("ok", None) ok = data.get("results", {}).get("ok", None)
super().visualize(data, img=self.status_imgs_full[ok]) # Preserve PERVIETÀ image during Free Fall-related steps
if getattr(self, "_free_fall_mode", False):
# Keep the current image (likely PERVIETÀ) instead of switching to status icons
cur_img = getattr(self, "img", None)
if cur_img is not None:
super().visualize(data, img=cur_img)
else:
super().visualize(data, img=self.status_imgs_full.get(ok, self.status_imgs_full[None]))
else:
super().visualize(data, img=self.status_imgs_full.get(ok, self.status_imgs_full[None]))
def display_text(self,text="", bg_color=None,text_color=None): def display_text(self,text="", bg_color=None,text_color=None):
# Display the message in the parent assembly widget if available # Display the message in the parent assembly widget if available