Example #1
0
class MutableAttributeHolder:

    __slots__ = ("__fit", "item", "attributes", "__state")

    def __init__(self, type_):
        self.__fit = None
        self.item = type_
        self.attributes = MutableAttributeMap(self)
        self.__state = State.offline

    @property
    def fit(self):
        return self.__fit

    @fit.setter
    def fit(self, newFit):
        self.attributes.clear()
        self.__fit = newFit

    @property
    def state(self):
        return self.__state

    @state.setter
    def state(self, newState):
        oldState = self.state
        if newState == oldState:
            return
        if self.fit is not None:
            self.fit._holderStateSwitch(self, newState)
        self.__state = newState
Example #2
0
 def __init__(self, type_):
     self.__fit = None
     self.item = type_
     self.attributes = MutableAttributeMap(self)
     self.__state = State.offline