diff --git a/src/qua_dashboards/video_mode/sweep_axis.py b/src/qua_dashboards/video_mode/sweep_axis.py index 25466c3..531e994 100644 --- a/src/qua_dashboards/video_mode/sweep_axis.py +++ b/src/qua_dashboards/video_mode/sweep_axis.py @@ -90,6 +90,7 @@ def create_axis_layout( ids = { "span": self._get_id("span"), "points": self._get_id("points"), + "attenuation": self._get_id("attenuation") } return dbc.Col( dbc.Card( @@ -114,6 +115,15 @@ def create_axis_layout( max=501, step=1, ), + create_input_field( + id=ids["attenuation"], + label="Attenuation (dB)", + value=self.attenuation, + step=0.1, + min=0, # or whatever bounds you want + max=120, + input_style={"width": "100px"}, + ), ], className="text-light", ), @@ -143,4 +153,12 @@ def update_parameters(self, parameters: Dict[str, Dict[str, Any]]) -> ModifiedFl if "points" in params and self.points != params["points"]: self.points = params["points"] flags |= ModifiedFlags.PARAMETERS_MODIFIED | ModifiedFlags.PROGRAM_MODIFIED + if "attenuation" in params: + try: + val = float(params["attenuation"]) + except (TypeError, ValueError): + val = self.attenuation if isinstance(self.attenuation, (int, float)) else 0.0 + if self.attenuation != val: + self.attenuation = val + flags |= ModifiedFlags.PARAMETERS_MODIFIED | ModifiedFlags.PROGRAM_MODIFIED return flags