예제 #1
0
 def paint_body(self, painter, option, widget):
     # Paint the body part.
     painter.setBrush(_qt.QBrush(_qt.QColor(*UI.node.body.brush)))
     painter.drawRect(
         self.x,
         self.y + UI.node.header.height,
         UI.node.width,
         self.height - UI.node.header.height,
     )
예제 #2
0
 def paint_label(self, painter, option, widget):
     # Paint the label part.
     painter.setBrush(_qt.QBrush(_qt.QColor(*UI.node.header.brush)))
     painter.drawRect(
         self.x,
         self.y,
         UI.node.width,
         UI.node.header.height,
     )
예제 #3
0
 def paint_resize_handle(self, painter, option, widget):
     """Paint the footer region of the node.
     """
     painter.setBrush(_qt.QBrush(_qt.QColor(*UI['header']['brush'])))
     painter.drawRect(
         self.x,
         self.y + self.height - self.resize_handle_size,
         UI.node.width,
         self.resize_handle_size,
     )
예제 #4
0
    def paint_highlight(self, painter, option, widget):
        """Highlight the node.

        Called when the node is selected.
        """
        path = _qt.QPainterPath()
        path.addRoundedRect(
            self.x,
            self.y,
            UI.node.width,
            self.height,
            UI.node.roundness,
            UI.node.roundness,
        )
        self.highlighter.setWidth(UI.node.highlight.padding * 2)
        outline = self.highlighter.createStroke(path)
        color = _qt.QColor(*UI.node.highlight.brush)
        painter.fillPath(outline, _qt.QBrush(color))
예제 #5
0
 def paint(self, painter, option, widget):
     if self.attribute.type == 'integer':
         painter.setBrush(_qt.QColor(*UI.plug.integer.brush))
     elif self.attribute.type == 'float':
         painter.setBrush(_qt.QColor(*UI.plug.float.brush))
     elif self.attribute.type == 'boolean':
         painter.setBrush(_qt.QColor(*UI.plug.boolean.brush))
     elif self.attribute.type == 'string':
         painter.setBrush(_qt.QColor(*UI.plug.string.brush))
     elif self.attribute.type == 'enum':
         painter.setBrush(_qt.QColor(*UI.plug.enum.brush))
     else:
         painter.setBrush(_qt.QColor(*UI.plug.brush))
     pen = _qt.QPen(_qt.QBrush(_qt.QColor(*UI.plug.pen.brush)),
                    UI.plug.pen.width)
     painter.setPen(_qtcore.Qt.NoPen)
     painter.drawEllipse(
         self.x,
         self.y,
         UI.plug.size,
         UI.plug.size,
     )
예제 #6
0
 def paint(self, painter, option, widget):
     """Draw a path between the source and destination `Attribute`."""
     self.compute_path()
     super(BaseConnection, self).paint(painter, option, widget)
     brush = _qt.QBrush(_qt.QColor(*UI.connection.brush))
     painter.fillPath(self.path(), brush)