def set(self, value, custom_command=True):
        """Set the value of the widget.

        value (string or list of strings representing paths)
            new value for widget.
        custom_command (boolean)
            indicates whether the custom command stored
            upon instantiation should be called after
            updating the value.
        """
        ### validate values received
        try:
            self.validate_value(value, self.available_items)

        ### if it doesn't validate, report error and exit
        ### method by returning

        except (TypeError, ValueError) as err:

            print(err)
            return

        ### changes are only performed if the new value is
        ### indeed different from the current one

        if self.value != value:

            ### store new value
            self.value = value

            ### update the widget image
            self.update_image()

            ### if requested, execute the custom command
            if custom_command:
                self.command()
Set the value of the widget.

        value (string or list of strings representing paths)
            new value for widget.
        custom_command (boolean)
            indicates whether the custom command stored
            upon instantiation should be called after
            updating the value.
        
nodezator/widget/sortingbutton.py