fix freefall

This commit is contained in:
eduar 2026-02-03 08:19:28 +01:00
parent 933be4f94d
commit ff78e93695

View File

@ -160,10 +160,6 @@ class Test_Leak(Test_Test):
super().visualize(None, img=self.status_imgs_full["calibrated-leak"])
else:
if step.step_type == "test_freefall_leak":
# Flag Free Fall mode for special UI handling
self._free_fall_mode = True
self._free_fall_img_scale = 1.75 # scale image to almost full available space
# Hide parameters not relevant during free-fall
for name in [
"label_18", # Tempo di riempimento
@ -420,15 +416,15 @@ class Test_Leak(Test_Test):
ok = data.get("results", {}).get("ok", None)
# Preserve PERVIETÀ image during Free Fall-related steps
if getattr(self, "_free_fall_mode", False):
#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]))
#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):
# Display the message in the parent assembly widget if available
@ -519,26 +515,3 @@ class Test_Leak(Test_Test):
# Always disable start button and enable stop button during connection issues
self.start_b.setEnabled(False)
self.stop_b.setEnabled(True)
def resizeEvent(self, event=None):
# First, let the base class handle default behavior
try:
super().resizeEvent(event)
except Exception:
# Fallback: ignore if base cannot handle the event
pass
# Apply Free Fall specific image scaling (half space)
if getattr(self, "_free_fall_mode", False):
if hasattr(self, "img_l") and hasattr(self, "img") and self.img_l is not None and self.img is not None:
try:
scale = float(getattr(self, "_free_fall_img_scale", 0.5) or 0.5)
except Exception:
scale = 0.5
w = max(1, int(self.img_l.width() * scale))
h = max(1, int(self.img_l.height() * scale))
try:
self.img_l.setPixmap(self.img.scaled(w, h, Qt.KeepAspectRatio, Qt.SmoothTransformation))
except Exception:
# If scaling fails, leave as base-class result
pass