Exemple #1
0
def run (x, y):
    icon_1 = QtWidgets.QGraphicsPathItem()
    icon_path_1 = QtGui.QPainterPath() 
    icon_path_1.addEllipse(x-15, y-15, 30, 30)
    icon_1.setPath(icon_path_1)
    icon_1.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.darkRed), 0 ))
    icon_1.setBrush(QtGui.QBrush(QtGui.QColor(QtCore.Qt.darkRed)))
    icon_1.setOpacity(0.2)
    
    icon_2 = QtWidgets.QGraphicsPathItem()
    icon_path_2 = QtGui.QPainterPath() 
    icon_path_2.moveTo(24.5, 12)
    icon_path_2.arcTo(5, 5, 20, 20, 20, 240)
    icon_2.setPath(icon_path_2)
    icon_2.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.darkRed), 1.5 ))
	
    icon_3 = QtWidgets.QGraphicsPathItem()
    icon_path_3 = QtGui.QPainterPath() 
    p1 = QtCore.QPointF(25, 16)
    p2 = QtCore.QPointF(26, 10)
    p3 = QtCore.QPointF(22, 11)
    p4 = QtCore.QPointF(25, 16)
    icon_path_3.addPolygon(QtGui.QPolygonF([p1, p2, p3, p4]))
    icon_3.setPath(icon_path_3)
    icon_3.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.darkRed), 0.75 )) 
    icon_3.setBrush(QtGui.QBrush(QtGui.QColor(QtCore.Qt.darkRed)))	
    
    icon_paths = [icon_1, icon_2, icon_3]
    return icon_paths
def run(x, y):
    icon_1 = QtWidgets.QGraphicsPathItem()
    icon_path_1 = QtGui.QPainterPath()
    icon_path_1.addEllipse(x - 12.5, y - 12.5, 25, 25)
    icon_1.setPath(icon_path_1)
    icon_1.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.darkRed), 0.75))
    icon_1.setBrush(QtGui.QBrush(QtGui.QColor(QtCore.Qt.darkRed)))
    icon_1.setOpacity(0.2)

    icon_2 = QtWidgets.QGraphicsPathItem()
    icon_path_2 = QtGui.QPainterPath()
    p1 = QtCore.QPointF(x - 7.5, y)
    p2 = QtCore.QPointF(x + 7.5, y)
    icon_path_2.addPolygon(QtGui.QPolygonF([p1, p2]))
    icon_2.setPath(icon_path_2)
    icon_2.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.darkRed), 0.75))

    icon_3 = QtWidgets.QGraphicsPathItem()
    icon_path_3 = QtGui.QPainterPath()
    p1 = QtCore.QPointF(x, y - 7.5)
    p2 = QtCore.QPointF(x, y + 7.5)
    icon_path_3.addPolygon(QtGui.QPolygonF([p1, p2]))
    icon_3.setPath(icon_path_3)
    icon_3.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.darkRed), 0.75))

    icon_paths = [icon_1, icon_2, icon_3]
    return icon_paths
Exemple #3
0
def run (x, y):
    icon_1 = QtWidgets.QGraphicsPathItem()
    icon_path_1 = QtGui.QPainterPath() 
    p1 = QtCore.QPointF(x, y+17.5)
    p2 = QtCore.QPointF(x+40, y+17.5)
    icon_path_1.addPolygon(QtGui.QPolygonF([p1, p2]))
    icon_1.setPath(icon_path_1)
    icon_1.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.darkRed), 0.75 ))
    
    icon_2 = QtWidgets.QGraphicsPathItem()
    icon_path_2 = QtGui.QPainterPath() 
    icon_path_2.addEllipse(x+11, y+5.5, 12, 12)
    icon_2.setPath(icon_path_2)
    icon_2.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.darkRed), 0.75 ))
    
    icon_3 = QtWidgets.QGraphicsPathItem()
    icon_path_3 = QtGui.QPainterPath() 
    icon_path_3.addEllipse(x+14, y+5.5, 12, 12)
    icon_3.setPath(icon_path_3)
    icon_3.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.darkRed), 0.75 ))
    
    icon_4 = QtWidgets.QGraphicsPathItem()
    icon_path_4 = QtGui.QPainterPath() 
    icon_path_4.addEllipse(x+17, y+5.5, 12, 12)
    icon_4.setPath(icon_path_4)
    icon_4.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.darkRed), 0.75 ))
    
    icon_paths = [icon_1, icon_2, icon_3, icon_4]
    return icon_paths
        
        
        
        
Exemple #4
0
def run(x, y):
    icon_1 = QtWidgets.QGraphicsPathItem()
    icon_path_1 = QtGui.QPainterPath()
    p1 = QtCore.QPointF(x, y + 15)
    p2 = QtCore.QPointF(x + 12, y + 15)
    icon_path_1.addPolygon(QtGui.QPolygonF([p1, p2]))
    icon_1.setPath(icon_path_1)
    icon_1.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.darkRed), 0.75))

    icon_2 = QtWidgets.QGraphicsPathItem()
    icon_path_2 = QtGui.QPainterPath()
    p1 = QtCore.QPointF(x + 12, y + 25)
    p2 = QtCore.QPointF(x + 12, y + 5)
    p3 = QtCore.QPointF(x + 32, y + 15)
    p4 = QtCore.QPointF(x + 12, y + 25)
    icon_path_2.addPolygon(QtGui.QPolygonF([p1, p2, p3, p4]))
    icon_2.setPath(icon_path_2)
    icon_2.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.darkRed), 0.75))
    icon_2.setBrush(QtGui.QBrush(QtGui.QColor(QtCore.Qt.darkRed)))

    icon_3 = QtWidgets.QGraphicsPathItem()
    icon_path_3 = QtGui.QPainterPath()
    p1 = QtCore.QPointF(x + 32, y + 15)
    p2 = QtCore.QPointF(x + 41, y + 15)
    icon_path_3.addPolygon(QtGui.QPolygonF([p1, p2]))
    icon_3.setPath(icon_path_3)
    icon_3.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.darkRed), 0.75))

    icon_paths = [icon_1, icon_2, icon_3]
    return icon_paths
def run (x, y):
    icon_1 = QtWidgets.QGraphicsPathItem()
    icon_path_1 = QtGui.QPainterPath() 
    icon_path_1.addEllipse(x-12.5, y-12.5, 25, 25)
    icon_1.setPath(icon_path_1)
    icon_1.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.blue), 1.5 ))
    icon_1.setBrush(QtGui.QBrush(QtGui.QColor(QtCore.Qt.blue)))
    icon_1.setOpacity(0.1)
    
    icon_2 = QtWidgets.QGraphicsPathItem()
    icon_path_2 = QtGui.QPainterPath()   
    p1 = QtCore.QPointF(x-8, y-2)
    p2 = QtCore.QPointF(x-7, y+7)
    p3 = QtCore.QPointF(x-6, y-4)
    p4 = QtCore.QPointF(x-5, y+8)
    p5 = QtCore.QPointF(x-4, y-7)
    p6 = QtCore.QPointF(x-3, y)
    p7 = QtCore.QPointF(x-2, y-6)
    p8 = QtCore.QPointF(x-1, y+3)
    p9 = QtCore.QPointF(x, y-4)
    p10 = QtCore.QPointF(x+1, y)
    p11 = QtCore.QPointF(x+2, y+9)
    p12 = QtCore.QPointF(x+3, y+5)
    p13 = QtCore.QPointF(x+4, y-7)
    p14 = QtCore.QPointF(x+5, y+4)
    p15 = QtCore.QPointF(x+6, y-7)
    p16 = QtCore.QPointF(x+7, y+5)
    icon_path_2.addPolygon(QtGui.QPolygonF([p1, p2, p3, p4, p5, p6, p7, p8, 
                                            p9, p10, p11, p12, p13, p14, p15, p16]))
    icon_2.setPath(icon_path_2)
    icon_2.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.red), 0.75 ))
    
    icon_paths = [icon_1, icon_2]
    return icon_paths
Exemple #6
0
def run(x, y):
    icon_1 = QtWidgets.QGraphicsPathItem()
    icon_path_1 = QtGui.QPainterPath()
    p1 = QtCore.QPointF(x, y + 15)
    p2 = QtCore.QPointF(x + 12, y + 15)
    icon_path_1.addPolygon(QtGui.QPolygonF([p1, p2]))
    icon_1.setPath(icon_path_1)
    icon_1.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.blue), 0.75))

    icon_2 = QtWidgets.QGraphicsPathItem()
    icon_path_2 = QtGui.QPainterPath()
    p1 = QtCore.QPointF(x + 12.5, y + 5)
    p2 = QtCore.QPointF(x + 12.5, y + 25)
    icon_path_2.addPolygon(QtGui.QPolygonF([p1, p2]))
    icon_2.setPath(icon_path_2)
    icon_2.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.blue), 0.75))

    icon_3 = QtWidgets.QGraphicsPathItem()
    icon_path_3 = QtGui.QPainterPath()
    p1 = QtCore.QPointF(x + 17.5, y + 5)
    p2 = QtCore.QPointF(x + 17.5, y + 25)
    icon_path_3.addPolygon(QtGui.QPolygonF([p1, p2]))
    icon_3.setPath(icon_path_3)
    icon_3.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.blue), 0.75))

    icon_4 = QtWidgets.QGraphicsPathItem()
    icon_path_4 = QtGui.QPainterPath()
    p1 = QtCore.QPointF(x + 17.5, y + 15)
    p2 = QtCore.QPointF(x + 30, y + 15)
    icon_path_4.addPolygon(QtGui.QPolygonF([p1, p2]))
    icon_4.setPath(icon_path_4)
    icon_4.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.blue), 0.75))

    icon_paths = [icon_1, icon_2, icon_3, icon_4]
    return icon_paths
Exemple #7
0
    def __init__(self, name, rect):
        super().__init__()

        self.setZValue(1.0)
        self.setAcceptHoverEvents(True)
        self.setAcceptedMouseButtons(Qt.LeftButton)

        self.props = NodeProps()

        self.__rect = rect
        self.__view_rect = rect
        self.__transform = QtGui.QTransform()

        self.__drag_pos = None

        self.__box = QtWidgets.QGraphicsPathItem(self)
        pen = QtGui.QPen()
        pen.setColor(Qt.black)
        pen.setWidth(2)
        self.__box.setPen(pen)
        self.__box.setBrush(QtGui.QColor(200, 200, 200))
        self.__box.setOpacity(0.7)

        self.__title = QtWidgets.QGraphicsSimpleTextItem(self)
        self.__title.setText(name)

        self.__body = NodeWidget(name)
        self.__body.setAutoFillBackground(False)
        self.__body.setAttribute(Qt.WA_NoSystemBackground, True)

        self.__body_proxy = QtWidgets.QGraphicsProxyWidget(self)
        self.__body_proxy.setWidget(self.__body)
    def __init__(self, windows, car):

        self.t = 0
        self.car = car
        self.windows = windows

        self.car_group = QtWidgets.QGraphicsItemGroup()
        self.windows.scene.addItem(self.car_group)
        self.r = self.car.direction[0] * (180 / math.pi) - 90
        transform = QTransform()
        transform.rotate(self.r)
        self.car_group.setTransform(transform)
        self.car_group.setZValue(1)
        self.path = QtGui.QPainterPath()
        self.voiture = QRectF(
            QPoint(self.car.position[0].x - self.car.longueur / 2,
                   self.car.position[0].y - self.car.largeur / 2),
            QPoint(self.car.position[0].x + self.car.longueur / 2,
                   self.car.position[0].y + self.car.largeur / 2))
        # self.voiture = QRectF(QPoint(self.car.position[0].x-self.car.largeur/2, self.car.position[0].y-self.car.longueur/2), QPoint(self.car.position[0].x+self.car.largeur/2, self.car.position[0].y+self.car.longueur/2))
        self.path.addRect(self.voiture)
        brush = QBrush(QtGui.QColor("Red"))
        item = QtWidgets.QGraphicsPathItem(self.path, self.car_group)
        item.setBrush(brush)
        item.setPen(QPen(QtGui.QColor("Red")))
Exemple #9
0
    def __init__(self,
                 xy_origin,
                 theta_target,
                 r1=0.5,
                 r2=0.8,
                 rotation=90,
                 linewidth=0.01,
                 color='white'):
        path = QtGui.QPainterPath()
        path.moveTo(r1, 0)
        path.arcTo(-r1, r1, 2 * r1, -2 * r1, 0, theta_target)
        path.arcTo(-r2, r2, 2 * r2, -2 * r2, theta_target, -theta_target)
        path.closeSubpath()
        qitem = QtWidgets.QGraphicsPathItem(path)
        self.br = QtGui.QBrush(QtGui.QColor(color))
        qitem.setPen(QtGui.QPen(self.br, linewidth))
        qitem.rotate(rotation)
        qitem.setPos(xy_origin[0], xy_origin[1])
        super(Target, self).__init__(qitem)

        self.xy_origin = xy_origin
        self.theta_target = theta_target
        self.r1 = r1
        self.r2 = r2
        self.rotation = rotation
        self.linewidth = linewidth
def run(x, y):
    icon_1 = QtWidgets.QGraphicsPathItem()
    icon_path_1 = QtGui.QPainterPath()
    p1 = QtCore.QPointF(x + 2, y + 28)
    p2 = QtCore.QPointF(x + 8, y + 28)
    p3 = QtCore.QPointF(x + 8, y + 12)
    p4 = QtCore.QPointF(x + 14, y + 12)
    p5 = QtCore.QPointF(x + 14, y + 28)
    p6 = QtCore.QPointF(x + 20, y + 28)
    p7 = QtCore.QPointF(x + 20, y + 12)
    p8 = QtCore.QPointF(x + 23, y + 12)
    p9 = QtCore.QPointF(x + 23, y + 28)
    p10 = QtCore.QPointF(x + 26, y + 28)
    p11 = QtCore.QPointF(x + 26, y + 12)
    p12 = QtCore.QPointF(x + 29, y + 12)
    p13 = QtCore.QPointF(x + 29, y + 28)
    p14 = QtCore.QPointF(x + 34, y + 28)

    icon_path_1.addPolygon(
        QtGui.QPolygonF(
            [p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14]))
    icon_1.setPath(icon_path_1)
    icon_1.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.blue), 0.75))

    icon_paths = [icon_1]
    return icon_paths
def run(x, y):

    icon_1 = QtWidgets.QGraphicsPathItem()
    icon_path_1 = QtGui.QPainterPath()
    icon_path_1.addRect(x, y, 14, 4)  #x,y,w,h
    icon_1.setPath(icon_path_1)
    icon_1.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.darkRed), 0.75))
    icon_1.setBrush(QtGui.QBrush(QtGui.QColor(QtCore.Qt.darkRed)))
    icon_1.setOpacity(0.7)

    icon_2 = QtWidgets.QGraphicsPathItem()
    icon_path_2 = QtGui.QPainterPath()
    icon_path_2.moveTo(x - 12, y - 4)
    icon_path_2.cubicTo(x - 6, y - 4, x - 4, y + 1.5, x,
                        y + 1.5)  #x1,y1,x2,y2,x_end,y_end
    icon_2.setPath(icon_path_2)
    icon_2.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.darkRed), 0.75))

    icon_3 = QtWidgets.QGraphicsPathItem()
    icon_path_3 = QtGui.QPainterPath()
    icon_path_3.moveTo(x - 12, y + 9)
    icon_path_3.cubicTo(x - 6, y + 9, x - 4, y + 3, x,
                        y + 3)  #x1,y1,x2,y2,x_end,y_end
    icon_3.setPath(icon_path_3)
    icon_3.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.darkRed), 0.75))

    icon_4 = QtWidgets.QGraphicsPathItem()
    icon_path_4 = QtGui.QPainterPath()
    icon_path_4.moveTo(x + 14, y + 1.5)
    icon_path_4.cubicTo(x + 20, y + 1.5, x + 22, y - 4, x + 26,
                        y - 4)  #x1,y1,x2,y2,x_end,y_end
    icon_4.setPath(icon_path_4)
    icon_4.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.darkRed), 0.75))

    icon_5 = QtWidgets.QGraphicsPathItem()
    icon_path_5 = QtGui.QPainterPath()
    icon_path_5.moveTo(x + 14, y + 3)
    icon_path_5.cubicTo(x + 20, y + 3, x + 22, y + 9, x + 26,
                        y + 9)  #x1,y1,x2,y2,x_end,y_end
    icon_5.setPath(icon_path_5)
    icon_5.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.darkRed), 0.75))

    icon_paths = [icon_1, icon_2, icon_3, icon_4, icon_5]
    return icon_paths
def run(x, y):
    icon_1 = QtWidgets.QGraphicsPathItem()
    icon_path_1 = QtGui.QPainterPath()
    icon_path_1.addEllipse(x - 12.5, y - 12.5, 25, 25)
    icon_1.setPath(icon_path_1)
    icon_1.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.blue), 0.75))
    icon_1.setBrush(QtGui.QBrush(QtGui.QColor(QtCore.Qt.blue)))
    icon_1.setOpacity(0.2)

    icon_2 = QtWidgets.QGraphicsPathItem()
    icon_path_2 = QtGui.QPainterPath()
    icon_path_2.moveTo(x - 10, y)
    icon_path_2.cubicTo(x, y + 20, x, y - 20, x + 10,
                        y)  #x1,y1,x2,y2,x_end,y_end
    icon_2.setPath(icon_path_2)
    icon_2.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.blue), 0.75))

    icon_paths = [icon_1, icon_2]
    return icon_paths
def run (x, y):
    icon_1 = QtWidgets.QGraphicsPathItem()
    icon_path_1 = QtGui.QPainterPath() 
    p1 = QtCore.QPointF(x, y+15)
    p2 = QtCore.QPointF(x+3, y+15)
    icon_path_1.addPolygon(QtGui.QPolygonF([p1, p2]))
    icon_1.setPath(icon_path_1)
    icon_1.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.blue), 0.75 ))
    
    icon_2 = QtWidgets.QGraphicsPathItem()
    icon_path_2 = QtGui.QPainterPath() 
    p1 = QtCore.QPointF(x+1, y+32)
    p2 = QtCore.QPointF(x+1, y-2)
    p3 = QtCore.QPointF(x+41, y+15)
    p4 = QtCore.QPointF(x+1, y+32)
    icon_path_2.addPolygon(QtGui.QPolygonF([p1, p2, p3, p4]))
    icon_2.setPath(icon_path_2)
    icon_2.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.blue), 0.75 )) 
    #icon_2.setBrush(QtGui.QBrush(QtGui.QColor(QtCore.Qt.blue)))

    icon_3 = QtWidgets.QGraphicsPathItem()
    icon_path_3 = QtGui.QPainterPath() 
    p1 = QtCore.QPointF(x+42.5, y+15)
    p2 = QtCore.QPointF(x+44, y+15)
    icon_path_3.addPolygon(QtGui.QPolygonF([p1, p2]))
    icon_3.setPath(icon_path_3)
    icon_3.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.blue), 0.75 )) 
    
    icon_4 = QtWidgets.QGraphicsPathItem()
    icon_path_4 = QtGui.QPainterPath() 
    font = QtGui.QFont("Arial", 7)
    font.setItalic(True)
    icon_path_4.addText(x+2, y+18, font, "TIA-LA")
    icon_4.setPath(icon_path_4)
    icon_4.setBrush(QtGui.QBrush(QtCore.Qt.blue))
    icon_4.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.blue), 0.1 ))
    
    icon_paths = [icon_2, icon_4]
    return icon_paths
        
        
        
        
Exemple #14
0
def run (x, y):
    
    icon_1 = QtWidgets.QGraphicsPathItem()
    icon_path_1 = QtGui.QPainterPath() 
    font = QtGui.QFont("Arial", 8)
    font.setItalic(True)
    icon_path_1.addText(x+4, y+4, font, "dt")
    icon_1.setPath(icon_path_1)
    icon_1.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.black), 0.25 ))
    icon_1.setBrush(QtGui.QBrush(QtCore.Qt.black))
    
    icon_2 = QtWidgets.QGraphicsPathItem()
    icon_path_2 = QtGui.QPainterPath() 
    icon_path_2.moveTo(x-5, y+15)
    icon_path_2.cubicTo(x-1, y+20, x+1, y-20, x+5, y-15) #x1,y1,x2,y2,x_end,y_end
    icon_2.setPath(icon_path_2)
    icon_2.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.black), 1 ))
 
    icon_paths = [icon_1, icon_2]
    return icon_paths
def run(x, y):
    icon_1 = QtWidgets.QGraphicsPathItem()
    icon_path_1 = QtGui.QPainterPath()
    p1 = QtCore.QPointF(x + 0.5, y + 0.5)
    p2 = QtCore.QPointF(x + 19.5, y + 19.5)
    icon_path_1.addPolygon(QtGui.QPolygonF([p1, p2]))
    icon_1.setPath(icon_path_1)
    icon_1.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.darkRed), 0.75))

    icon_paths = [icon_1]
    return icon_paths
def run (x, y):
    icon_1 = QtWidgets.QGraphicsPathItem()
    icon_path_1 = QtGui.QPainterPath() 
    icon_path_1.addEllipse(x-12.5, y-12.5, 25, 25)
    icon_1.setPath(icon_path_1)
    icon_1.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.blue), 0.75 ))
    icon_1.setBrush(QtGui.QBrush(QtGui.QColor(QtCore.Qt.blue)))
    icon_1.setOpacity(0.2)
    
    icon_2 = QtWidgets.QGraphicsPathItem()
    icon_path_2 = QtGui.QPainterPath() 
    font = QtGui.QFont("Arial", 10)
    font.setItalic(True)
    icon_path_2.addText(x-7.5, y+4, font, "f(t)")
    icon_2.setPath(icon_path_2)
    icon_2.setBrush(QtGui.QBrush(QtCore.Qt.blue))
    icon_2.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.blue), 0.1 ))
    
    icon_paths = [icon_1, icon_2]
    return icon_paths
def run(x, y):
    icon_1 = QtWidgets.QGraphicsPathItem()
    icon_path_1 = QtGui.QPainterPath()
    icon_path_1.addEllipse(x - 12.5, y - 12.5, 12.5, 12.5)
    icon_1.setPath(icon_path_1)
    icon_1.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.darkRed), 1))
    icon_1.setBrush(QtGui.QBrush(QtGui.QColor('#e5e5e5')))
    #icon_1.setOpacity(0.2)

    icon_paths = [icon_1]
    return icon_paths
def run(x, y):

    #phi_sym = '\u03D5'
    #https://pythonforundergradengineers.com/unicode-characters-in-python.html
    #(accessed 24 Apr 2019)
    # https://en.wikipedia.org/wiki/Phi (accessed 24 Apr 2019)

    icon_1 = QtWidgets.QGraphicsPathItem()
    icon_path_1 = QtGui.QPainterPath()
    font = QtGui.QFont("Arial", 11)
    font.setItalic(True)
    icon_path_1.addText(x, y - 2, font, 'y')
    icon_1.setPath(icon_path_1)
    icon_1.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.blue), 0.25))
    icon_1.setBrush(QtGui.QBrush(QtCore.Qt.blue))

    icon_2 = QtWidgets.QGraphicsPathItem()
    icon_path_2 = QtGui.QPainterPath()
    p1 = QtCore.QPointF(x - 5, y - 15)
    p2 = QtCore.QPointF(x - 5, y + 3)
    p3 = QtCore.QPointF(x - 3, y + 1)
    p4 = QtCore.QPointF(x - 7, y + 1)
    p5 = QtCore.QPointF(x - 5, y + 3)
    icon_path_2.addPolygon(QtGui.QPolygonF([p1, p2, p3, p4, p5]))
    icon_2.setPath(icon_path_2)
    icon_2.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.blue), 0.75))
    icon_2.setBrush(QtGui.QBrush(QtGui.QColor(QtCore.Qt.blue)))

    icon_3 = QtWidgets.QGraphicsPathItem()
    icon_path_3 = QtGui.QPainterPath()
    p1 = QtCore.QPointF(x - 5, y - 15)
    p2 = QtCore.QPointF(x - 3, y - 13)
    p3 = QtCore.QPointF(x - 7, y - 13)
    p4 = QtCore.QPointF(x - 5, y - 15)
    icon_path_3.addPolygon(QtGui.QPolygonF([p1, p2, p3, p4]))
    icon_3.setPath(icon_path_3)
    icon_3.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.blue), 0.75))
    icon_3.setBrush(QtGui.QBrush(QtGui.QColor(QtCore.Qt.blue)))

    icon_paths = [icon_1, icon_2, icon_3]
    return icon_paths
Exemple #19
0
def run(x, y):
    icon_1 = QtWidgets.QGraphicsPathItem()
    icon_path_1 = QtGui.QPainterPath()
    font = QtGui.QFont("Arial", 10)
    font.setItalic(True)
    icon_path_1.addText(x, y, font, "A/D")
    icon_1.setPath(icon_path_1)
    icon_1.setBrush(QtGui.QBrush(QtCore.Qt.black))
    icon_1.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.black), 0.1))

    icon_paths = [icon_1]
    return icon_paths
Exemple #20
0
    def addArrowPart(self, color, rel):
        pen = QtG.QPen(QtG.QColor(color))
        pen.setWidthF(15)
        RoundJoin = 0x80
        pen.setJoinStyle(RoundJoin)

        x, y = self.coordinatesOfSquare(49, rel)
        x1, y1 = self.coordinatesOfSquare(50, rel)
        x2, y2 = self.coordinatesOfSquare(51, rel)

        path_Item = QtW.QGraphicsPathItem()
        path = QtG.QPainterPath()

        if rel == 0:
            path.moveTo(x + 20, y + 30)
            path.lineTo(x1 + 20, y1 + 30)
            path.lineTo(x2 + 20, y2 + 30)
            path.lineTo(x2 + 40, y2 + 30)
            points = [(x2 + 40, y2 + 15), (x2 + 40, y2 + 45),
                      (x2 + 57, y2 + 30)]
            self.addPolygon(points, color, color)

        elif rel == 1:
            path.moveTo(x + 30, y + 30)
            path.lineTo(x1 + 30, y1 + 20)
            path.lineTo(x2 + 30, y2 + 20)
            path.lineTo(x2 + 30, y2 + 40)
            points = [(x2 + 15, y2 + 40), (x2 + 45, y2 + 40),
                      (x2 + 30, y2 + 57)]
            self.addPolygon(points, color, color)

        elif rel == 2:
            path.moveTo(x + 40, y + 30)
            path.lineTo(x1 + 40, y1 + 30)
            path.lineTo(x2 + 40, y2 + 30)
            path.lineTo(x2 + 20, y2 + 30)
            points = [(x2 + 20, y2 + 15), (x2 + 20, y2 + 45),
                      (x2 + 3, y2 + 30)]
            self.addPolygon(points, color, color)

        elif rel == 3:
            path.moveTo(x + 30, y + 40)
            path.lineTo(x1 + 30, y1 + 40)
            path.lineTo(x2 + 30, y2 + 40)
            path.lineTo(x2 + 30, y2 + 20)
            points = [(x2 + 15, y2 + 20), (x2 + 45, y2 + 20),
                      (x2 + 30, y2 + 3)]
            self.addPolygon(points, color, color)

        path_Item.setPath(path)
        path_Item.setPen(pen)
        self.addItem(path_Item)
Exemple #21
0
def run(x, y):
    icon_1 = QtWidgets.QGraphicsPathItem()
    icon_path_1 = QtGui.QPainterPath()
    p1 = QtCore.QPointF(x, y + 15)
    p2 = QtCore.QPointF(x + 10, y + 15)
    p3 = QtCore.QPointF(x + 15, y + 10)
    p4 = QtCore.QPointF(x + 30, y + 10)
    icon_path_1.addPolygon(QtGui.QPolygonF([p1, p2, p3, p4]))
    icon_1.setPath(icon_path_1)
    icon_1.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.blue), 0.75))

    icon_2 = QtWidgets.QGraphicsPathItem()
    icon_path_2 = QtGui.QPainterPath()
    p1 = QtCore.QPointF(x + 10, y + 15)
    p2 = QtCore.QPointF(x + 15, y + 20)
    p3 = QtCore.QPointF(x + 30, y + 20)
    icon_path_2.addPolygon(QtGui.QPolygonF([p1, p2, p3]))
    icon_2.setPath(icon_path_2)
    icon_2.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.blue), 0.75))

    icon_paths = [icon_1, icon_2]
    return icon_paths
Exemple #22
0
def run (x, y):
    icon_1 = QtWidgets.QGraphicsPathItem()
    icon_path_1 = QtGui.QPainterPath() 
    p1 = QtCore.QPointF(x-7.5, y-10)
    p2 = QtCore.QPointF(x+29, y+10)
    p3 = QtCore.QPointF(x-7.5, y+30)
    p4 = QtCore.QPointF(x-7.5, y-10)
    icon_path_1.addPolygon(QtGui.QPolygonF([p1, p2, p3, p4]))
    icon_1.setPath(icon_path_1)
    icon_1.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.blue), 0.75 ))
    icon_1.setBrush(QtGui.QBrush(QtGui.QColor(QtCore.Qt.blue)))
    icon_1.setOpacity(0.2)
    
    icon_2 = QtWidgets.QGraphicsPathItem()
    icon_path_2 = QtGui.QPainterPath()
    p1 = QtCore.QPointF(x-3, y+4)
    p2 = QtCore.QPointF(x+3, y+4)
    icon_path_2.addPolygon(QtGui.QPolygonF([p1, p2]))
    icon_2.setPath(icon_path_2)
    icon_2.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.blue), 0.75 ))
    
    icon_3 = QtWidgets.QGraphicsPathItem()
    icon_path_3 = QtGui.QPainterPath()
    p1 = QtCore.QPointF(x, y+1)
    p2 = QtCore.QPointF(x, y+7)
    icon_path_3.addPolygon(QtGui.QPolygonF([p1, p2]))
    icon_3.setPath(icon_path_3)
    icon_3.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.blue), 0.75 ))
    
    icon_4 = QtWidgets.QGraphicsPathItem()
    icon_path_4 = QtGui.QPainterPath()
    p1 = QtCore.QPointF(x-3, y+16)
    p2 = QtCore.QPointF(x+3, y+16)
    icon_path_4.addPolygon(QtGui.QPolygonF([p1, p2]))
    icon_4.setPath(icon_path_4)
    icon_4.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.blue), 0.75 ))
    
    icon_paths = [icon_1, icon_2, icon_3, icon_4]
    return icon_paths
def run(x, y):
    icon_1 = QtWidgets.QGraphicsPathItem()
    icon_path_1 = QtGui.QPainterPath()
    icon_path_1.addEllipse(x - 7.5, y - 7.5, 10, 10)
    icon_1.setPath(icon_path_1)
    icon_1.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.darkRed), 0.75))
    icon_1.setBrush(QtGui.QBrush(QtGui.QColor(QtCore.Qt.darkRed)))
    icon_1.setOpacity(0.8)

    icon_2 = QtWidgets.QGraphicsPathItem()
    icon_path_2 = QtGui.QPainterPath()
    p1 = QtCore.QPointF(x - 9.5, y + 4.5)
    p2 = QtCore.QPointF(x + 4, y - 9)
    icon_path_2.addPolygon(QtGui.QPolygonF([p1, p2]))
    icon_2.setPath(icon_path_2)
    icon_2.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.darkRed), 1.25))
    icon_2.setOpacity(0.8)

    icon_3 = QtWidgets.QGraphicsPathItem()
    icon_path_3 = QtGui.QPainterPath()
    p1 = QtCore.QPointF(x + 4.5, y - 9.5)
    p2 = QtCore.QPointF(x + 3, y - 6)
    icon_path_3.addPolygon(QtGui.QPolygonF([p1, p2]))
    icon_3.setPath(icon_path_3)
    icon_3.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.darkRed), 1))
    icon_3.setOpacity(0.8)

    icon_4 = QtWidgets.QGraphicsPathItem()
    icon_path_4 = QtGui.QPainterPath()
    p1 = QtCore.QPointF(x + 4.5, y - 9.5)
    p2 = QtCore.QPointF(x + 1, y - 8)
    icon_path_4.addPolygon(QtGui.QPolygonF([p1, p2]))
    icon_4.setPath(icon_path_4)
    icon_4.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.darkRed), 1))
    icon_4.setOpacity(0.8)

    icon_paths = [icon_1, icon_2, icon_3, icon_4]
    return icon_paths
Exemple #24
0
def run(x, y):
    icon_1 = QtWidgets.QGraphicsPathItem()
    icon_path_1 = QtGui.QPainterPath()
    p1 = QtCore.QPointF(x + 5, y + 15)
    p2 = QtCore.QPointF(x + 10, y + 15)
    p3 = QtCore.QPointF(x + 15, y + 10)
    p4 = QtCore.QPointF(x + 28, y + 10)
    p5 = QtCore.QPointF(x + 33, y + 15)
    p6 = QtCore.QPointF(x + 38, y + 15)
    icon_path_1.addPolygon(QtGui.QPolygonF([p1, p2, p3, p4, p5, p6]))
    icon_1.setPath(icon_path_1)
    icon_1.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.black), 0.75))

    icon_2 = QtWidgets.QGraphicsPathItem()
    icon_path_2 = QtGui.QPainterPath()
    p1 = QtCore.QPointF(x + 10, y + 15)
    p2 = QtCore.QPointF(x + 15, y + 20)
    p3 = QtCore.QPointF(x + 28, y + 20)
    p4 = QtCore.QPointF(x + 33, y + 15)
    icon_path_2.addPolygon(QtGui.QPolygonF([p1, p2, p3, p4]))
    icon_2.setPath(icon_path_2)
    icon_2.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.black), 0.75))

    icon_3 = QtWidgets.QGraphicsPathItem()
    icon_path_3 = QtGui.QPainterPath()
    p1 = QtCore.QPointF(x + 16, y + 8)
    p2 = QtCore.QPointF(x + 27, y + 8)
    icon_path_3.addPolygon(QtGui.QPolygonF([p1, p2]))
    icon_3.setPath(icon_path_3)
    icon_3.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.blue), 1))

    icon_4 = QtWidgets.QGraphicsPathItem()
    icon_path_4 = QtGui.QPainterPath()
    p1 = QtCore.QPointF(x + 16, y + 12)
    p2 = QtCore.QPointF(x + 27, y + 12)
    icon_path_4.addPolygon(QtGui.QPolygonF([p1, p2]))
    icon_4.setPath(icon_path_4)
    icon_4.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.blue), 1))

    icon_5 = QtWidgets.QGraphicsPathItem()
    icon_path_5 = QtGui.QPainterPath()
    p1 = QtCore.QPointF(x + 16, y + 18)
    p2 = QtCore.QPointF(x + 27, y + 18)
    icon_path_5.addPolygon(QtGui.QPolygonF([p1, p2]))
    icon_5.setPath(icon_path_5)
    icon_5.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.blue), 1))

    icon_6 = QtWidgets.QGraphicsPathItem()
    icon_path_6 = QtGui.QPainterPath()
    p1 = QtCore.QPointF(x + 16, y + 22)
    p2 = QtCore.QPointF(x + 27, y + 22)
    icon_path_6.addPolygon(QtGui.QPolygonF([p1, p2]))
    icon_6.setPath(icon_path_6)
    icon_6.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.blue), 1))

    icon_paths = [icon_1, icon_2, icon_3, icon_4, icon_5, icon_6]
    return icon_paths
Exemple #25
0
    def add_airport_items(self):
        """ Adds the airport (as a group) to the QGraphicsScene, drawn by the view"""

        airport_group = QtWidgets.QGraphicsItemGroup()
        self.scene.addItem(airport_group)
        airport_group.setZValue(AIRPORT_Z_VALUE)

        apt = self.simulation.airport

        # Taxiways
        pen = QPen(QtGui.QColor(APT_COLOR), airport.TAXIWAY_WIDTH)
        pen.setCapStyle(QtCore.Qt.RoundCap)
        for taxiway in apt.taxiways:
            path = QtGui.QPainterPath()
            path.moveTo(taxiway.coords[0].x, taxiway.coords[0].y)
            for xy in taxiway.coords[1:]:
                path.lineTo(xy.x, xy.y)
            item = QtWidgets.QGraphicsPathItem(path, airport_group)
            item.setPen(pen)
            item.setToolTip('Taxiway ' + taxiway.taxi_name)

        # Runways
        pen = QPen(QtGui.QColor(APT_COLOR), airport.RUNWAY_WIDTH)
        for runway in apt.runways:
            (p1, p2) = runway.coords
            item = QtWidgets.QGraphicsLineItem(p1.x, p1.y, p2.x, p2.y,
                                               airport_group)
            item.setPen(pen)
            item.setToolTip('Runway ' + runway.name)

        # Named points
        pen = QPen(QtCore.Qt.transparent)
        width = 0.7 * traffic.SEP
        dw = width / 2.
        for point in apt.points:
            bounds = QtCore.QRectF(point.x - dw, point.y - dw, width, width)
            if point.type == airport.PointType.STAND:
                item = QtWidgets.QGraphicsEllipseItem(bounds, airport_group)
                item.setBrush(STAND_BRUSH)
                point_type_description = "Stand"
            else:
                item = QtWidgets.QGraphicsRectItem(bounds, airport_group)
                item.setBrush(POINT_BRUSH)
                if point.type == airport.PointType.RUNWAY_POINT:
                    point_type_description = "Runway point"
                else:
                    point_type_description = "Deicing point"
            item.setPen(pen)
            item.setToolTip(point_type_description + ' ' + point.name)
Exemple #26
0
def run (x, y):
    icon_1 = QtWidgets.QGraphicsPathItem()
    icon_path_1 = QtGui.QPainterPath() 
    icon_path_1.addEllipse(x-12.5, y-12.5, 25, 25)
    icon_1.setPath(icon_path_1)
    icon_1.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.blue), 0.75 ))
    icon_1.setBrush(QtGui.QBrush(QtGui.QColor(QtCore.Qt.blue)))
    icon_1.setOpacity(0.2)
    
    icon_2 = QtWidgets.QGraphicsPathItem()
    icon_path_2 = QtGui.QPainterPath() 
    p1 = QtCore.QPointF(x, y-8)
    p2 = QtCore.QPointF(x, y-2)
    icon_path_2.addPolygon(QtGui.QPolygonF([p1, p2]))  
    icon_2.setPath(icon_path_2)
    icon_2.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.blue), 0.75 ))
    
    icon_3 = QtWidgets.QGraphicsPathItem()
    icon_path_3 = QtGui.QPainterPath() 
    p1 = QtCore.QPointF(x-3, y-5)
    p2 = QtCore.QPointF(x+3, y-5)
    icon_path_3.addPolygon(QtGui.QPolygonF([p1, p2]))  
    icon_3.setPath(icon_path_3)
    icon_3.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.blue), 0.75 ))

    icon_4 = QtWidgets.QGraphicsPathItem()
    icon_path_4 = QtGui.QPainterPath() 
    p1 = QtCore.QPointF(x-3, y+6)
    p2 = QtCore.QPointF(x+3, y+6)
    icon_path_4.addPolygon(QtGui.QPolygonF([p1, p2]))  
    icon_4.setPath(icon_path_4)
    icon_4.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.blue), 0.75 ))

    
    icon_paths = [icon_1, icon_2, icon_3, icon_4]
    return icon_paths
Exemple #27
0
def run(x, y):
    icon_1 = QtWidgets.QGraphicsPathItem()
    icon_path_1 = QtGui.QPainterPath()
    p1 = QtCore.QPointF(x + 5, y + 27.5)
    p2 = QtCore.QPointF(x + 15, y + 27.5)
    p3 = QtCore.QPointF(x + 15, y + 7.5)
    p4 = QtCore.QPointF(x + 20, y + 7.5)
    p5 = QtCore.QPointF(x + 20, y + 27.5)
    p6 = QtCore.QPointF(x + 30, y + 27.5)
    icon_path_1.addPolygon(QtGui.QPolygonF([p1, p2, p3, p4, p5, p6]))
    icon_1.setPath(icon_path_1)
    icon_1.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.darkRed), 1))

    icon_paths = [icon_1]
    return icon_paths
Exemple #28
0
    def add_piste(self):
        #création des éléments de la piste
        track_group = QtWidgets.QGraphicsItemGroup()
        self.scene.addItem(track_group)

        pen = QPen(QtGui.QColor(TK_COLOR), LARGEUR)
        pen.setJoinStyle(Qt.RoundJoin)
        self.extrem(4)

        path = QtGui.QPainterPath()
        path.moveTo(self.piste[0].x, self.piste[0].y)
        for i in range(1, len(self.piste)):
            path.lineTo(self.piste[i].x, self.piste[i].y)
        item = QtWidgets.QGraphicsPathItem(path, track_group)
        item.setPen(pen)
    def graph_connection(self, source_path, dest_path):
        src = self.items_by_path.get(source_path)
        dest = self.items_by_path.get(dest_path)
        print src, dest
        if not src or not dest:
            return

        src_bound = src.boundingRect()
        src_pos = src.pos() + QtCore.QPointF(src_bound.width(),src_bound.height() * 0.5)
        dest_pos = dest.pos() + QtCore.QPointF(0,dest.boundingRect().height() * 0.5)

        path = QtGui.QPainterPath(src_pos)
        offset = QtCore.QPointF(self.width * 0.5, 0.0)
        path.cubicTo(src_pos+offset, dest_pos - offset,dest_pos)
        path_item = QtWidgets.QGraphicsPathItem(path)
        self.scene.addItem(path_item)
Exemple #30
0
def run(x, y):
    icon_1 = QtWidgets.QGraphicsPathItem()
    icon_path_1 = QtGui.QPainterPath()
    p1 = QtCore.QPointF(x + 3, y)
    p2 = QtCore.QPointF(x - 1, y)
    p3 = QtCore.QPointF(x - 1, y + 30)
    p4 = QtCore.QPointF(x + 3, y + 30)
    icon_path_1.addPolygon(QtGui.QPolygonF([p1, p2, p3, p4]))
    icon_1.setPath(icon_path_1)
    icon_1.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.darkRed), 0.75))

    icon_2 = QtWidgets.QGraphicsPathItem()
    icon_path_2 = QtGui.QPainterPath()
    p1 = QtCore.QPointF(x + 27, y)
    p2 = QtCore.QPointF(x + 31, y)
    p3 = QtCore.QPointF(x + 31, y + 30)
    p4 = QtCore.QPointF(x + 27, y + 30)
    icon_path_2.addPolygon(QtGui.QPolygonF([p1, p2, p3, p4]))
    icon_2.setPath(icon_path_2)
    icon_2.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.darkRed), 0.75))

    font = QtGui.QFont("Arial", 6)
    font.setItalic(True)

    icon_3 = QtWidgets.QGraphicsPathItem()
    icon_path_3 = QtGui.QPainterPath()
    icon_path_3.addText(x + 1.5, y + 9, font, 'Jxx')
    icon_3.setPath(icon_path_3)
    icon_3.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.darkRed), 0.25))
    icon_3.setBrush(QtGui.QBrush(QtCore.Qt.darkRed))

    icon_4 = QtWidgets.QGraphicsPathItem()
    icon_path_4 = QtGui.QPainterPath()
    icon_path_4.addText(x + 16, y + 9, font, 'Jxy')
    icon_4.setPath(icon_path_4)
    icon_4.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.darkRed), 0.25))
    icon_4.setBrush(QtGui.QBrush(QtCore.Qt.darkRed))

    icon_5 = QtWidgets.QGraphicsPathItem()
    icon_path_5 = QtGui.QPainterPath()
    icon_path_5.addText(x + 1.5, y + 26, font, 'Jyx')
    icon_5.setPath(icon_path_5)
    icon_5.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.darkRed), 0.25))
    icon_5.setBrush(QtGui.QBrush(QtCore.Qt.darkRed))

    icon_6 = QtWidgets.QGraphicsPathItem()
    icon_path_6 = QtGui.QPainterPath()
    icon_path_6.addText(x + 16, y + 26, font, 'Jyy')
    icon_6.setPath(icon_path_6)
    icon_6.setPen(QtGui.QPen(QtGui.QBrush(QtCore.Qt.darkRed), 0.25))
    icon_6.setBrush(QtGui.QBrush(QtCore.Qt.darkRed))

    icon_paths = [icon_1, icon_2, icon_3, icon_4, icon_5, icon_6]
    return icon_paths