Beispiel #1
0
    def drawBackground(self, painter, rect):
        painter.setBrush(_qt.QColor(*UI.graph.brush))
        painter.drawRect(rect)

        for i, lines in enumerate(self.get_grid_lines(rect)):
            color = _qt.QColor(*UI.graph.grid.lines[i]['pen'])
            thickness = UI.graph.grid.lines[i]['thickness']
            painter.setPen(_qt.QPen(color, thickness))
            painter.drawLines(lines)
Beispiel #2
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,
     )
Beispiel #3
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,
     )
Beispiel #4
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,
     )
Beispiel #5
0
 def paint_label_text(self, painter, option, widget):
     # Paint the label text
     font = _qt.QFont(
         UI.node.label.font.family,
         UI.node.label.font.size,
         UI.node.label.font.weight,
     )
     painter.setFont(font)
     painter.setPen(_qt.QColor(*UI.node.label.pen))
     painter.drawText(
         self.x + UI.node.label.offset,
         self.y,
         UI.node.width - UI.node.label.offset,
         UI.node.header.height,
         _qtcore.Qt.AlignVCenter | _qtcore.Qt.AlignLeft,
         self.name,
     )
Beispiel #6
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))
Beispiel #7
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,
     )
Beispiel #8
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)