from repository.item.Item import Item# ...class DetailSynchronizer(Item): """ Mixin class that handles synchronization and notification common to most of the blocks in the detail view. """ def onSetContentsEvent(self, event): #logger.debug("%s: onSetContentsEvent: %s, %s", debugName(self), #event.arguments['item'], event.arguments['collection']) self.setContentsOnBlock(event.arguments['item'], event.arguments['collection']) isVisible = schema.One(schema.Boolean, defaultValue=True) item = property(fget=Block.Block.getProxiedContents, doc="Return the selected item, or None") def synchronizeWidget(self, useHints=False): super(DetailSynchronizer, self).synchronizeWidget(useHints) self.show(self.item is not None and self.shouldShow(self.item)) def setVisibility(self, shouldBeVisible): self.isVisible = shouldBeVisible def shouldShow(self, item): return self.isVisible