diff --git a/src/ui/test/test.py b/src/ui/test/test.py index fbd07f8..a7e5e55 100755 --- a/src/ui/test/test.py +++ b/src/ui/test/test.py @@ -50,6 +50,14 @@ class Test(Widget): self.user_l.setStyleSheet("QLabel { color: red; }") else: self.user_l.setStyleSheet("") + + self.flag_label.setVisible(False) + if len(sys.argv) > 1: + self.flag_label.setVisible(True) + self.update_label_with_args() # Initial update + else: + self.flag_label.setVisible(False) + # SHOW AND UPDATE TIME CLOCK self.refresh_time(init=True) # INIT RECIPE @@ -827,3 +835,28 @@ class Test(Widget): else: self.error_label.setText("Errore RFID.") # Update the GUI label self.error_label.setStyleSheet("color: red;") + + def update_label_with_args(self, extra_info=None): + """ + Updates the flag label with current command-line arguments and optional extra info, + and sets the tooltip text dynamically. + + Args: + extra_info (str): Optional. Extra information to append to the label text. + """ + # Combine command-line arguments + args_text = " ".join(sys.argv[1:]) if len(sys.argv) > 1 else None # None if no args + + if args_text: # If there are CLI arguments + # Combine CLI args and extra info for label text + if extra_info: + args_text += f" | Additional Info: {extra_info}" + + # Update label text and set the tooltip + self.flag_label.setText(f"ATTENTION SYSTEM ARGUMENTS PASSED") + self.flag_label.setStyleSheet("QLabel { color: red; font-weight: bold; }") + self.flag_label.setToolTip(f"Arguments: {args_text}") + self.flag_label.setVisible(True) # Ensure label is visible + else: # No args provided + self.flag_label.setVisible(False) # Hide label + self.flag_label.setToolTip("") # Clear tooltip \ No newline at end of file diff --git a/src/ui/test/test.ui b/src/ui/test/test.ui index 195c61a..d9c33e2 100755 --- a/src/ui/test/test.ui +++ b/src/ui/test/test.ui @@ -19,6 +19,7 @@ 12 + 75 true @@ -51,34 +52,21 @@ 3 - - - - - 12 - true - + + + + Qt::Horizontal - - - + + QSizePolicy::Fixed - - Qt::AlignCenter + + + 20 + 20 + - - - - - - - 12 - true - - - - - - - + @@ -103,6 +91,7 @@ 12 + 75 true @@ -111,6 +100,101 @@ + + + + + 12 + 75 + true + + + + - + + + Qt::AlignCenter + + + + + + + + 12 + 75 + true + + + + 12345 + + + Qt::AlignCenter + + + + + + + + 12 + 75 + true + + + + 12345 +567 + + + Qt::AlignCenter + + + + + + + + DejaVu Sans + 11 + 75 + true + + + + AZZERA +CONTATORE + + + + + + + + 12 + 75 + true + + + + OPERATORE: + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + @@ -134,6 +218,7 @@ 12 + 75 true @@ -142,122 +227,31 @@ - - + + 12 + 75 true - ULTIMO AUTOTEST: - - - Qt::AlignCenter + - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - + + 12 + 75 true - 12345 -567 - - - Qt::AlignCenter - - - - - - - - DejaVu Sans - 11 - true - - - - AZZERA -CONTATORE - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 12 - true - - - - OPERATORE: - - - - - - - - 0 - 0 - - - - - 12 - true - - - - N. DISEGNO: - - - - - - - - 12 - true - - - - 12345 + PEZZI FATTI Qt::AlignCenter @@ -277,19 +271,17 @@ CONTATORE - - + + - 12 + 16 + 75 true - PROSSIMO AUTOTEST: - - - Qt::AlignCenter + TextLabel @@ -298,6 +290,7 @@ CONTATORE 12 + 75 true @@ -309,16 +302,17 @@ CONTATORE - - + + 12 + 75 true - PEZZI FATTI + ULTIMO AUTOTEST: Qt::AlignCenter @@ -342,6 +336,7 @@ CONTATORE 12 + 75 true @@ -350,27 +345,25 @@ CONTATORE - - + + Qt::Horizontal - - QSizePolicy::Fixed - - 20 + 40 20 - + 16 + 75 true @@ -382,17 +375,60 @@ CONTATORE - - + + - 16 + 12 + 75 true + + PROSSIMO AUTOTEST: + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 12 + 75 + true + + + + N. DISEGNO: + + + + + + + + 0 + 0 + + + + QFrame::NoFrame + TextLabel + + Qt::MarkdownText +