'Set an instance of `SchemeNode`. The widget will be initialized
with its icon and channels.'

def setSchemeNode(self, node):

    self.node = node
    if (self.__direction == Qt.LeftToRight):
        channels = node.output_channels()
    else:
        channels = node.input_channels()
    self.channels = channels
    loader = icon_loader.from_description(node.description)
    icon = loader.get(node.description.icon)
    self.setIcon(icon)
    label_template = '<div    align="{align}"><span    class="channelname">{name}</span></div>'
    if (self.__direction == Qt.LeftToRight):
        align = 'right'
        label_alignment = (Qt.AlignVCenter | Qt.AlignRight)
        anchor_alignment = (Qt.AlignVCenter | Qt.AlignLeft)
        label_row = 0
        anchor_row = 1
    else:
        align = 'left'
        label_alignment = (Qt.AlignVCenter | Qt.AlignLeft)
        anchor_alignment = (Qt.AlignVCenter | Qt.AlignLeft)
        label_row = 1
        anchor_row = 0
    self.__channelAnchors = []
    grid = self.__channelLayout
    for (i, channel) in enumerate(channels):
        text = label_template.format(align=align, name=escape(channel.name))
        text_item = GraphicsTextWidget(self)
        text_item.setHtml(text)
        text_item.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        text_item.setToolTip(escape(getattr(channel, 'description', channel.type)))
        grid.addItem(text_item, i, label_row, alignment=label_alignment)
        anchor = ChannelAnchor(self, channel=channel, rect=QRectF(0, 0, 20, 20))
        anchor.setBrush(self.palette().brush(QPalette.Mid))
        layout_item = GraphicsItemLayoutItem(grid, item=anchor)
        grid.addItem(layout_item, i, anchor_row, alignment=anchor_alignment)
        anchor.setToolTip(escape(channel.type))
        self.__channelAnchors.append(anchor)
