class LibraryModel(Model): def __init__(self, controler): Model.__init__(self, controler.window, controler.REFRESH_DOMAIN) self.controler = controler self.compatibility = self.window.compatibility self.objects = Objects(controler, {}) def clear(self): self.objects.clear() def refresh(self, all_updates, updates): # updateObjects() fills all_update to ask to redisplay the references # of updated objects data = self.ruleset("getObjects", self.name, append_fusion=True) self.objects.updateObjects(self.controler, data, all_updates, updates) def __getitem__(self, identifier): return self.objects[identifier] def __iter__(self): return self.objects.itervalues() def delete(self, object): identifier = object["id"] return self.ruleset("objectDelete", self.name, identifier) def templatize(self, identifier): return self.ruleset("objectTemplatize", self.name, identifier, self.window.useFusion())
def __init__(self, controler): Model.__init__(self, controler.window, controler.REFRESH_DOMAIN) self.controler = controler self.compatibility = self.window.compatibility self.objects = Objects(controler, {})