def __setattr__(self, name, value): if not self.__initialised: super().__setattr__(name, value) return if name not in self.__ATTRIBUTES: if hasattr(self, name): super().__setattr__(name, value) return raise AttributeError("There is no attribute named %s" % name) data = dict(self.__data) self.__data.update(attr.asdict(_action.AddImageAction(**{ **self.__EMPTY_BASE_PAIRS, **self.__data, **attr.asdict(_action.Identifiable(identifier=self.identifier)), name: value }))) # remove the key's of the empty base pairs # so the developer is forced to set them by himself for key in self.__EMPTY_BASE_PAIRS: if key not in data and key != name: del self.__data[key] if self.visibility is Visibility.VISIBLE: self.__update()
def __update(self): self.__canvas.enqueue( _action.AddImageAction( **{ **self.__data, **attr.asdict( _action.Identifiable(identifier=self.identifier)) })) self.__canvas.request_transmission()