def reset_value_and_available_items(
        self,
        value,
        available_items,
        custom_command=True,
    ):
        """Reset available items and set given value."""
        ## check whether the value and options are valid

        try:
            self.validate_value(value, available_items)
        except (ValueError, TypeError) as err:

            print(err)
            return

        ## set the value and the options

        self.value = value
        self.available_items = available_items

        ##
        self.update_image()

        ## execute custom command if requested
        if custom_command:
            self.command()
Reset available items and set given value.
nodezator/widget/sortingbutton.py