(self, data, transform=())
Set the editor data.

        Note
        ----
        This must be a `DataVector` as the vector's values are needed for type
        reinterpretation/casts.

        If the `transform` sequence contains ReinterpretTransform then it
        must be in the first position.
Set the editor data.
Set the editor data .
def set_data(self, data, transform=()):  # pylint: disable=arguments-differ
        # type: (Optional[DataVector], Sequence[Transform]) -> None
        """
        Set the editor data.

        Note
        ----
        This must be a `DataVector` as the vector's values are needed for type
        reinterpretation/casts.

        If the `transform` sequence contains ReinterpretTransform then it
        must be in the first position.
        """
        type_transform = None  # type: Optional[ReinterpretTransform]
        if transform:
            _tr = transform[0]
            if isinstance(_tr, ReinterpretTransformTypes):
                type_transform = _tr
                transform = transform[1:]
            assert not any(isinstance(t, ReinterpretTransformTypes)
                           for t in transform)
        self.__transform = type_transform
        self.__data = data
        self.var = data.vtype if data is not None else None

        if type_transform is not None and data is not None:
            data = type_transform(data)
        if data is not None:
            var = data.vtype
        else:
            var = None
        index = self._editors.get(type(var), -1)
        self.layout().setCurrentIndex(index)
        if index != -1:
            w = self.layout().currentWidget()
            assert isinstance(w, VariableEditor)
            if isinstance(var, Categorical):
                w.set_data_categorical(var, data.data(), transform=transform)
            else:
                w.set_data(var, transform=transform)
            self.__history[var] = tuple(transform)
            cb = w.findChild(QComboBox, "type-combo")
            cb.setCurrentIndex(index)
def set_data ( self , data , transform = ( ) ) : # pylint: disable=arguments-differ # type: (Optional[DataVector], Sequence[Transform]) -> None type_transform = None # type: Optional[ReinterpretTransform] if transform : _tr = transform [ 0 ] if isinstance ( _tr , ReinterpretTransformTypes ) : type_transform = _tr transform = transform [ 1 : ] assert not any ( isinstance ( t , ReinterpretTransformTypes ) for t in transform ) self . __transform = type_transform self . __data = data self . var = data . vtype if data is not None else None if type_transform is not None and data is not None : data = type_transform ( data ) if data is not None : var = data . vtype else : var = None index = self . _editors . get ( type ( var ) , - 1 ) self . layout ( ) . setCurrentIndex ( index ) if index != - 1 : w = self . layout ( ) . currentWidget ( ) assert isinstance ( w , VariableEditor ) if isinstance ( var , Categorical ) : w . set_data_categorical ( var , data . data ( ) , transform = transform ) else : w . set_data ( var , transform = transform ) self . __history [ var ] = tuple ( transform ) cb = w . findChild ( QComboBox , "type-combo" ) cb . setCurrentIndex ( index )