예제 #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)
예제 #2
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,
     )