Beispiel #1
0
    def draw (self, painter, rect):
        if not self._visible:
            return

        lines = []
        baseLines = []

        start = self.closestNode (rect.topLeft ())

        i = round (start.x () / self._size) % self._step
        for x in xfrange (start.x (), rect.right (), self._size):
            line = QLineF (x, rect.top (), x, rect.bottom ())
            if i % self._step == 0:
                baseLines.append (line)
            else:
                lines.append (line)
            i += 1

        i = round (start.y () / self._size) % self._step
        for y in xfrange (start.y (), rect.bottom (), self._size):
            line = QLineF (rect.left (), y, rect.right (), y)
            if i % self._step == 0:
                baseLines.append (line)
            else:
                lines.append (line)
            i += 1

        painter.setPen (self._normalPen)
        painter.drawLines (lines)
        painter.setPen (self._baselinePen)
        painter.drawLines (baseLines)
Beispiel #2
0
    def draw(self, painter, rect):
        if not self._visible:
            return

        lines = []
        baseLines = []

        start = self.closestNode(rect.topLeft())

        i = round(start.x() / self._size) % self._step
        for x in xfrange(start.x(), rect.right(), self._size):
            line = QLineF(x, rect.top(), x, rect.bottom())
            if i % self._step == 0:
                baseLines.append(line)
            else:
                lines.append(line)
            i += 1

        i = round(start.y() / self._size) % self._step
        for y in xfrange(start.y(), rect.bottom(), self._size):
            line = QLineF(rect.left(), y, rect.right(), y)
            if i % self._step == 0:
                baseLines.append(line)
            else:
                lines.append(line)
            i += 1

        painter.setPen(self._normalPen)
        painter.drawLines(lines)
        painter.setPen(self._baselinePen)
        painter.drawLines(baseLines)
Beispiel #3
0
 def draw (self, painter, rect):
     if not self._visible:
         return
     start = self.closestNode (rect.topLeft ())
     painter.setPen (self._normalColor)
     for x in xfrange (start.x (), rect.right (), self._size):
         dots = []
         for y in xfrange (start.y (), rect.bottom (), self._size):
             dots.append (QPointF (x, y))
         painter.drawPoints (QPolygonF (dots))
Beispiel #4
0
 def draw(self, painter, rect):
     if not self._visible:
         return
     start = self.closestNode(rect.topLeft())
     painter.setPen(self._normalColor)
     for x in xfrange(start.x(), rect.right(), self._size):
         dots = []
         for y in xfrange(start.y(), rect.bottom(), self._size):
             dots.append(QPointF(x, y))
         painter.drawPoints(QPolygonF(dots))