def from_json()

in src/open_vp_cal/project_settings.py [0:0]


    def from_json(cls, json_file: str):
        """Create a ProjectSettings object from a JSON file.

        Args:
            json_file (str): The path to the JSON file.

        Returns:
            ProjectSettings: A ProjectSettings object.
        """
        project_settings = cls._settings_from_json_file(json_file)
        if not project_settings:
            raise ValueError(f'No project settings found in {json_file}')
        instance = cls()
        default_ocio = instance.ocio_config_path
        instance._project_settings = project_settings
        walls = []

        # We cant set up the reference walls until all walls are loaded, so we remove it and create a map
        reference_wall_map = {}
        verification_wall_map = {}
        for wall in instance.led_walls:
            reference_wall_map[wall[constants.LedWallSettingsKeys.NAME]] = wall[
                constants.LedWallSettingsKeys.REFERENCE_WALL
            ]
            verification_wall_map[wall[constants.LedWallSettingsKeys.NAME]] = wall[
                constants.LedWallSettingsKeys.VERIFICATION_WALL
            ]
            del wall[constants.LedWallSettingsKeys.REFERENCE_WALL]
            del wall[constants.LedWallSettingsKeys.VERIFICATION_WALL]
            walls.append(instance._led_wall_class.from_dict(instance, wall))
        instance.led_walls = walls

        # Now we have all the walls loaded, we can re set up the reference walls and verification wall links
        for led_wall in instance.led_walls:
            reference_wall = reference_wall_map[led_wall.name]
            if reference_wall:
                led_wall.reference_wall = reference_wall
            verification_wall = verification_wall_map[led_wall.name]
            if verification_wall:
                led_wall.verification_wall = verification_wall
        if not instance.ocio_config_path:
            instance.ocio_config_path = default_ocio
        return instance