'Update message items (position, visibility and tool tips).'

def __updateMessages(self):

    items = [self.errorItem, self.warningItem, self.infoItem]
    messages = [self.__error, self.__warning, self.__info]
    for (message, item) in zip(messages, items):
        item.setVisible(bool(message))
        item.setToolTip((message or ''))
    shown = [item for item in items if item.isVisible()]
    count = len(shown)
    if count:
        spacing = 3
        rects = [item.boundingRect() for item in shown]
        width = sum((rect.width() for rect in rects))
        width += (spacing * max(0, (count - 1)))
        height = max((rect.height() for rect in rects))
        origin = ((self.shapeItem.boundingRect().top() - spacing) - height)
        origin = QPointF(((- width) / 2), origin)
        for (item, rect) in zip(shown, rects):
            item.setPos(origin)
            origin = (origin + QPointF((rect.width() + spacing), 0))
