(self)
Reset the painting to input data if present.
Reset the painting to input data if present.
Reset the painting to input data if present .
def reset_to_input(self):
        """Reset the painting to input data if present."""
        if self.input_data is None:
            return
        self.undo_stack.clear()

        index = self.selected_class_label()
        if self.input_colors is not None:
            palette = self.input_colors
        else:
            palette = colorpalettes.DefaultRGBColors
        self.colors = palette
        self.class_model.colors = palette
        self.class_model[:] = self.input_classes

        newindex = min(max(index, 0), len(self.class_model) - 1)
        itemmodels.select_row(self.classValuesView, newindex)

        self.data = self.input_data.tolist()
        self.__buffer = self.input_data.copy()

        prev_attr2 = self.hasAttr2
        self.hasAttr2 = self.input_has_attr2
        if prev_attr2 != self.hasAttr2:
            self.set_dimensions()
        else:  # set_dimensions already calls _replot, no need to call it again
            self._replot()

        self.commit.deferred()
def reset_to_input ( self ) : if self . input_data is None : return self . undo_stack . clear ( ) index = self . selected_class_label ( ) if self . input_colors is not None : palette = self . input_colors else : palette = colorpalettes . DefaultRGBColors self . colors = palette self . class_model . colors = palette self . class_model [ : ] = self . input_classes newindex = min ( max ( index , 0 ) , len ( self . class_model ) - 1 ) itemmodels . select_row ( self . classValuesView , newindex ) self . data = self . input_data . tolist ( ) self . __buffer = self . input_data . copy ( ) prev_attr2 = self . hasAttr2 self . hasAttr2 = self . input_has_attr2 if prev_attr2 != self . hasAttr2 : self . set_dimensions ( ) else : # set_dimensions already calls _replot, no need to call it again self . _replot ( ) self . commit . deferred ( )