예제 #1
0
    def __init__(self, port_mode, port_type, parent):
        QGraphicsLineItem.__init__(self)
        self.setParentItem(parent)

        self.m_port_mode = port_mode
        self.m_port_type = port_type

        # Port position doesn't change while moving around line
        self.p_lineX = self.scenePos().x()
        self.p_lineY = self.scenePos().y()
        self.p_width = parent.getPortWidth()

        if port_type == PORT_TYPE_AUDIO_JACK:
            pen = QPen(canvas.theme.line_audio_jack, 2)
        elif port_type == PORT_TYPE_MIDI_JACK:
            pen = QPen(canvas.theme.line_midi_jack, 2)
        elif port_type == PORT_TYPE_MIDI_ALSA:
            pen = QPen(canvas.theme.line_midi_alsa, 2)
        elif port_type == PORT_TYPE_PARAMETER:
            pen = QPen(canvas.theme.line_parameter, 2)
        else:
            qWarning(
                "PatchCanvas::CanvasLineMov({}, {}, {}) - invalid port type".
                format(port_mode2str(port_mode), port_type2str(port_type),
                       parent))
            pen = QPen(Qt.black)

        pen.setCapStyle(Qt.RoundCap)
        pen.setWidthF(pen.widthF() + 0.00001)
        self.setPen(pen)
예제 #2
0
 def __init__(self, w, h, fgcolor):
     QGraphicsLineItem.__init__(self)
     self.setLine(w / 2., 0, w / 2., h)
     if fgcolor:
         self.setPen(QPen(QColor(fgcolor)))
     else:
         self.setPen(QPen(QColor('#000000')))
예제 #3
0
    def __init__(self, source, dest, id, graphicsGraphView):
        # Parent constructor(s)
        GraphicsEdge.__init__(self, source, dest, id, graphicsGraphView)
        QGraphicsLineItem.__init__(self)

        self.setFlag(QGraphicsItem.ItemIsSelectable)
        self.update()
예제 #4
0
 def __init__(self, source, dest, parent=None):
     QGraphicsLineItem.__init__(self, parent)
     self.source = source
     self.dest = dest
     self.source.addEdge(self)
     self.dest.addEdge(self)
     self.line_color = QColor(153, 153, 153)
     self.line_color.setAlpha(40)
     self.setPen(QPen(self.line_color, 1.75))
     self.adjust()
예제 #5
0
    def __init__(self, item1, item2, parent):
        QGraphicsLineItem.__init__(self)
        self.setParentItem(parent)

        self.item1 = item1
        self.item2 = item2

        self.m_locked = False
        self.m_lineSelected = False

        self.setGraphicsEffect(None)
        self.updateLinePos()
예제 #6
0
    def __init__(self, shape):
        QGraphicsLineItem.__init__(self)
        StMove.__init__(self, shape)

        self.allwaysshow = False
        self.path = QPainterPath()

        self.setFlag(QGraphicsItem.ItemIsSelectable, False)

        self.pen = QPen(QColor(50, 100, 255), 1, QtCore.Qt.SolidLine,
                        QtCore.Qt.RoundCap, QtCore.Qt.RoundJoin)
        self.pen.setCosmetic(True)
        self.make_papath()
예제 #7
0
파일: canvas2d.py 프로젝트: opme/dxf2gcode
    def __init__(self, shape):
        QGraphicsLineItem.__init__(self)
        StMove.__init__(self, shape)

        self.allwaysshow = False
        self.path = QPainterPath()

        self.setFlag(QGraphicsItem.ItemIsSelectable, False)

        self.pen = QPen(QColor(50, 100, 255), 1, QtCore.Qt.SolidLine,
                        QtCore.Qt.RoundCap, QtCore.Qt.RoundJoin)
        self.pen.setCosmetic(True)
        self.make_papath()
예제 #8
0
    def __init__(self, startNode, endNode):
        QGraphicsLineItem.__init__(self)
        self.setPen(QPen())

        self.startNode = startNode
        self.endNode = endNode

        self.startNode.addObserver(self)

        startShape = self.startNode.mapToScene(self.startNode.shape())

        p1 = closestPointTo(self.endNode, startShape)

        self.setLine(QLineF(p1, self.endNode))
예제 #9
0
파일: edge.py 프로젝트: MatthieuDien/DotEd
    def __init__(self, startNode, endNode):
        QGraphicsLineItem.__init__(self)
        self.setPen(QPen())

        self.startNode = startNode
        self.endNode = endNode

        self.startNode.addObserver(self)

        startShape = self.startNode.mapToScene(self.startNode.shape())

        p1 = closestPointTo(self.endNode, startShape)
                
        self.setLine(QLineF(p1, self.endNode))
예제 #10
0
    def __init__(self, startNode, endNode):
        QGraphicsLineItem.__init__(self)
        self.setPen(QPen())

        self.startNode = startNode
        self.endNode = endNode

        self.startNode.addObserver(self)
        self.endNode.addObserver(self)

        startShape = self.startNode.mapToScene(self.startNode.shape())
        endShape = self.endNode.mapToScene(self.endNode.shape())

        p1 = closestPointTo(endShape.boundingRect().center(), startShape)
        p2 = closestPointTo(startShape.boundingRect().center(), endShape)

        self.setLine(QLineF(p1, p2))

        self.setFlags(QGraphicsItem.ItemIsSelectable)
예제 #11
0
파일: edge.py 프로젝트: MatthieuDien/DotEd
    def __init__(self, startNode, endNode):
        QGraphicsLineItem.__init__(self)
        self.setPen(QPen())
                
        self.startNode = startNode
        self.endNode = endNode

        self.startNode.addObserver(self)
        self.endNode.addObserver(self)

        startShape = self.startNode.mapToScene(self.startNode.shape())
        endShape = self.endNode.mapToScene(self.endNode.shape())

        p1 = closestPointTo(endShape.boundingRect().center(), startShape)
        p2 = closestPointTo(startShape.boundingRect().center(), endShape)
                
        self.setLine(QLineF(p1, p2))

        self.setFlags(QGraphicsItem.ItemIsSelectable)
예제 #12
0
    def __init__(self, first_node, second_node, weight, scene):
        QGraphicsLineItem.__init__(self)

        pen = QPen(QColor("green"), 5)
        self.first_node = first_node
        self.second_node = second_node
        self.weight = weight
        self.setZValue(1)
        self.setPen(pen)
        self.setLine(self.first_node.x() + 25,
                     self.first_node.y() + 25,
                     self.second_node.x() + 25,
                     self.second_node.y() + 25)

        self.number = QGraphicsTextItem(str(weight))
        self.number.setZValue(6)

        x = (first_node.x() + second_node.x()) / 2
        y = (first_node.y() + second_node.y()) / 2

        self.number.setPos(x, y)

        scene.addItem(self)
        scene.addItem(self.number)
예제 #13
0
    def __init__(self, source, dest):
        # Parent constructor(s)
        QGraphicsLineItem.__init__(self)

        self.source = source
        self.dest = dest
예제 #14
0
 def __init__(self, x1, y1, x2, y2, parent=None):
     QGraphicsLineItem.__init__(self, x1, y1, x2, y2, parent)
     self.setAcceptHoverEvents(True)
예제 #15
0
    def __init__(self, source, dest):
        # Parent constructor(s)
        QGraphicsLineItem.__init__(self)

        self.source = source
        self.dest = dest
예제 #16
0
 def __init__(self, x1, y1, x2, y2, parent=None):
     QGraphicsLineItem.__init__(self, x1, y1, x2, y2, parent)
     self.setAcceptHoverEvents(True)