Exemplo n.º 1
0
 def draw(self, painter: QPainter):
     pen = QPen(Layer.color(LayerType.annotate))
     pen.setCapStyle(Qt.RoundCap)
     pen.setJoinStyle(Qt.RoundJoin)
     pen.setWidth(0)
     painter.setPen(pen)
     painter.drawLine(self.pt1, self.pt2)
Exemplo n.º 2
0
 def draw(self, painter):
     pen = QPen(Layer.color(LayerType.annotate))
     pen.setCapStyle(Qt.RoundCap)
     pen.setJoinStyle(Qt.RoundJoin)
     pen.setWidth(0)
     painter.setPen(pen)
     if self._firstPt is not None:
         painter.drawLine(self._firstPt, self._pos)
Exemplo n.º 3
0
 def draw(self, painter):
     pen = QPen(Layer.color(LayerType.selection))
     pen.setCapStyle(Qt.RoundCap)
     pen.setJoinStyle(Qt.RoundJoin)
     pen.setWidth(0)
     painter.setPen(pen)
     for h in self._handles:
         h.draw(painter)
     painter.drawLine(self._obj.pt1, self._obj.pt2)
Exemplo n.º 4
0
 def paintEvent(self, event):
     painter = QPainter(self)
     # erase background
     painter.setBackground(QBrush(Layer.color(LayerType.background)))
     painter.setClipping(True)
     painter.eraseRect(self.rect())
     # draw document
     if self._ctrl is not None:
         # draw grid
         painter.setRenderHint(QPainter.Antialiasing, False)
         pen = QPen(Layer.color(LayerType.grid))
         pen.setCapStyle(Qt.RoundCap)
         pen.setJoinStyle(Qt.RoundJoin)
         pen.setWidth(0)
         painter.setTransform(self._transform)
         painter.setPen(pen)
         self._drawGrid(painter)
         # draw drawables
         # painter.setRenderHint(QPainter.Antialiasing)
         for d in self._ctrl.getDrawables():
             d.draw(painter)
     painter.end()
Exemplo n.º 5
0
 def paintEvent(self, event):
     painter = QPainter(self)
     # erase background
     painter.setBackground(QBrush(Layer.color(LayerType.background)))
     painter.setClipping(True)
     painter.eraseRect(self.rect())
     # draw document
     if self._ctrl is not None:
         # draw grid
         painter.setRenderHint(QPainter.Antialiasing, False)
         pen = QPen(Layer.color(LayerType.grid))
         pen.setCapStyle(Qt.RoundCap)
         pen.setJoinStyle(Qt.RoundJoin)
         pen.setWidth(0)
         painter.setTransform(self._transform)
         painter.setPen(pen)
         self._drawGrid(painter)
         # draw drawables
         # painter.setRenderHint(QPainter.Antialiasing)
         for d in self._ctrl.getDrawables():
             d.draw(painter)
     painter.end()
Exemplo n.º 6
0
 def drawJunctions(doc, painter: QPainter):
     painter.setPen(Qt.NoPen)
     painter.setBrush(QBrush(Layer.color(LayerType.junction)))
     nets = doc.objects(objType=NetObj)
     juncts = defaultdict(set)
     while nets:
         n = nets.pop()
         # check net against every other net in set
         for n2 in nets:
             v = n.connVtx(n2)
             if v:
                 juncts[v].add(n)
                 juncts[v].add(n2)
     for pt, nets in juncts.items():
         if len(nets) > 2:
             painter.drawEllipse(QPoint(pt.x, pt.y), 500, 500)