def on_model_data_changed()

in src/open_vp_cal/widgets/project_settings_widget.py [0:0]


    def on_model_data_changed(self, key: str, value: object):
        """
        Updates the UI component corresponding to the data key when the data value changes.

        Parameters
        ----------
        key : str
            key of the data
        value : object
            new value of the data
        """
        if not self.model.current_wall:
            for view in self.get_views():
                view.disable()
            return

        for view in self.get_views():
            view.enable()

        for view in self.get_views():
            if hasattr(view, key):
                if isinstance(getattr(view, key), QComboBox):
                    if isinstance(value, LedWallSettings):
                        value = value.name
                    getattr(view, key).setCurrentText(str(value))
                elif isinstance(getattr(view, key), QLineEdit):
                    getattr(view, key).setText(value)
                elif isinstance(getattr(view, key), (QSpinBox, QDoubleSpinBox)):
                    getattr(view, key).setValue(value)
                elif isinstance(getattr(view, key), QCheckBox):
                    getattr(view, key).setChecked(value)

        # If we select a sequence which has no sequence loaded we handle the disabling of params
        self.handle_plate_settings_if_no_sequence_loaded_or_verification_wall(self.model.current_wall.name)
        self.highlight_invalid_settings(self.model.current_wall.name)
        self.lock_target_max_nits(self.model.current_wall.name)