def __init__(self, graphics, *args): QGraphicsPathItem.__init__(self, *args) path = path_from_graphics(graphics) self.setPath(path) self.setAcceptHoverEvents(True) self._actions = [] self.link = None
def __init__(self, edge, modObj): QGraphicsPathItem.__init__(self) self.__edge = edge self.__modObj = modObj startPoint = QPointF(edge.points[0][0], edge.points[0][1]) painterPath = QPainterPath(startPoint) index = 1 while index + 3 <= len(edge.points): painterPath.cubicTo(edge.points[index][0], edge.points[index][1], edge.points[index + 1][0], edge.points[index + 1][1], edge.points[index + 2][0], edge.points[index + 2][1]) index = index + 3 if index + 2 <= len(edge.points): painterPath.quadTo(edge.points[index + 1][0], edge.points[index + 1][1], edge.points[index + 2][0], edge.points[index + 2][1]) index = index + 2 if index + 1 <= len(edge.points): painterPath.lineTo(edge.points[index + 1][0], edge.points[index + 1][1]) self.setPath(painterPath) return
def __init__( self, edge, modObj, connObj ): QGraphicsPathItem.__init__( self ) self.__edge = edge self.__modObj = modObj self.__connObj = connObj startPoint = QPointF( edge.points[ 0 ][ 0 ], edge.points[ 0 ][ 1 ] ) painterPath = QPainterPath( startPoint ) index = 1 while index + 3 <= len( edge.points ): painterPath.cubicTo(edge.points[index][0], edge.points[index][1], edge.points[index+1][0],edge.points[index+1][1], edge.points[index+2][0],edge.points[index+2][1]) index = index + 3 if index + 2 <= len( edge.points ): painterPath.quadTo(edge.points[index+1][0], edge.points[index+1][1], edge.points[index+2][0], edge.points[index+2][1]) index = index + 2 if index + 1 <= len( edge.points ): painterPath.lineTo(edge.points[index+1][0], edge.points[index+1][1]) lastIndex = len( edge.points ) - 1 self.addArrow( painterPath, edge.points[lastIndex-1][0], edge.points[lastIndex-1][1], edge.points[lastIndex][0], edge.points[lastIndex][1] ) self.setPath( painterPath ) return
def __init__(self, edge): QGraphicsPathItem.__init__(self) self.__edge = edge startPoint = QPointF(edge.points[0][0], edge.points[0][1]) painterPath = QPainterPath(startPoint) index = 1 while index + 3 <= len(edge.points): painterPath.cubicTo(edge.points[index][0], edge.points[index][1], edge.points[index + 1][0], edge.points[index + 1][1], edge.points[index + 2][0], edge.points[index + 2][1]) index = index + 3 if index + 2 <= len(edge.points): painterPath.quadTo(edge.points[index + 1][0], edge.points[index + 1][1], edge.points[index + 2][0], edge.points[index + 2][1]) index = index + 2 if index + 1 <= len(edge.points): painterPath.lineTo(edge.points[index + 1][0], edge.points[index + 1][1]) if edge.head != edge.tail: lastIndex = len(edge.points) - 1 self.addArrow(painterPath, edge.points[lastIndex - 1][0], edge.points[lastIndex - 1][1], edge.points[lastIndex][0], edge.points[lastIndex][1]) self.setPath(painterPath) return
def __init__(self, graphics, *args): QGraphicsPathItem.__init__(self, *args) path = path_from_graphics(graphics) self.setPath(path) self.setAcceptHoverEvents(True) self._actions = [] self.link = None
def __init__(self, radiusOut, raiusIn, angle, arcLen, parent=None): QGraphicsPathItem.__init__(self, parent=parent) self._radiusOut = radiusOut self._raiusIn = raiusIn self._angle = angle self._arcLen = arcLen self._pen = QPen(QColor('#000000')) self._pen.setWidth(1) self.setPen(self._pen) self._hoverPen = QPen(QColor('#000000')) self._hoverPen.setWidth(2) brush = QBrush(QColor('#FF9966')) self.setBrush(brush) rectOut = QRectF(-radiusOut, -radiusOut, radiusOut*2.0, radiusOut*2.0) rectIn = QRectF(-raiusIn, -raiusIn, raiusIn*2.0, raiusIn*2.0) startAngle = angle - arcLen/2.0 endAngle = angle + arcLen/2.0 path = QPainterPath() path.arcMoveTo(rectIn, startAngle) path.arcTo(rectOut, startAngle, arcLen) path.arcTo(rectIn, endAngle, 0) path.arcTo(rectIn, endAngle, -arcLen) self.setPath(path) self._isHover = False self._ioDragFirstPos = None
def __init__(self, longitudes, latitudes, scene, parent=None): QGraphicsPathItem.__init__(self, parent=parent, scene=scene) assert len(longitudes) == len(latitudes) self._longitudes = np.array(longitudes, dtype=np.float32) self._latitudes = np.array(latitudes, dtype=np.float32) self.updatePosition(scene)
def __init__(self, longitudes, latitudes, scene, parent=None): QGraphicsPathItem.__init__(self, parent=parent, scene=scene) assert len(longitudes) == len(latitudes) self._longitudes = np.array(longitudes, dtype=np.float32) self._latitudes = np.array(latitudes, dtype=np.float32) self.updatePosition(scene)
def __init__(self, parent=None): QGraphicsPathItem.__init__(self, parent=parent) self._startName = None self._endName = None self._path = None self._startPos = None self._endPos = None pen = QPen(QBrush(QColor(Qt.black)), 2.0) self.setPen(pen)
def __init__( self, settings, x1, y1, x2, y2 ): QGraphicsPathItem.__init__( self ) self.__settings = settings path = QPainterPath() path.moveTo( x1, y1 ) path.lineTo( x2, y2 ) self.setPath( path ) self.penStyle = None self.penColor = None self.penWidth = None return
def __init__(self, p0, p1, parent=None): QGraphicsPathItem.__init__(self, parent=parent) self._p0 = p0 self._p1 = p1 self._startPoint = QGraphicsEllipseItem(-3, -3, 6, 6, parent=self) self._startPoint.setPos(p0) self._endPoint = QGraphicsEllipseItem(-3, -3, 6, 6, parent=self) self._endPoint.setVisible(False) brush = QBrush(QColor(Qt.black)) self._startPoint.setBrush(brush) self._endPoint.setBrush(brush) pen = QPen(brush, 2.0) self.setPen(pen)
def __init__(self, parent): QGraphicsPathItem.__init__(self, parent) if not isinstance(parent, LinkItem): raise TypeError("'LinkItem' expected") self.setAcceptedMouseButtons(Qt.NoButton) self.__canvasLink = parent self.setAcceptHoverEvents(True) self.shadow = QGraphicsDropShadowEffect(blurRadius=5, color=QColor(SHADOW_COLOR), offset=QPointF(0, 0)) self.normalPen = QPen(QBrush(QColor("#9CACB4")), 2.0) self.hoverPen = QPen(QBrush(QColor("#7D7D7D")), 2.1) self.setPen(self.normalPen) self.setGraphicsEffect(self.shadow) self.shadow.setEnabled(False) self.__hover = False self.__enabled = True self.__shape = None
def __init__(self, parent): QGraphicsPathItem.__init__(self, parent) if not isinstance(parent, LinkItem): raise TypeError("'LinkItem' expected") self.setAcceptedMouseButtons(Qt.NoButton) self.__canvasLink = parent self.setAcceptHoverEvents(True) self.shadow = QGraphicsDropShadowEffect( blurRadius=5, color=QColor(SHADOW_COLOR), offset=QPointF(0, 0) ) self.normalPen = QPen(QBrush(QColor("#9CACB4")), 2.0) self.hoverPen = QPen(QBrush(QColor("#7D7D7D")), 2.1) self.setPen(self.normalPen) self.setGraphicsEffect(self.shadow) self.shadow.setEnabled(False) self.__hover = False
def __init__(self, point=QtCore.QPointF(0,0), parent=None, scene=None,\ brush=QtGui.QBrush(Qt.white, Qt.SolidPattern),\ pen=QtGui.QPen(Qt.black, 2, Qt.SolidLine),\ orient='v', rsize=7) : self._lst_circle = None path = self.pathForPointV(point, scene, rsize) if orient=='v' else\ self.pathForPointH(point, scene, rsize) if orient=='h' else\ self.pathForPointR(point, scene, rsize) QGraphicsPathItem.__init__(self, path, parent, scene) GUDragBase.__init__(self, parent, brush, pen) self.setAcceptHoverEvents(True) self.setAcceptTouchEvents(True) #self.setAcceptedMouseButtons(Qt.LeftButton) self.setPen(self._pen_pos) self.setBrush(self._brush) self.setFlags(self.ItemIsSelectable | self.ItemIsMovable) #self.setBoundingRegionGranularity(0.95) self._mode = ADD
def __init__(self, parent, pos, angle, length=0): QGraphicsPathItem.__init__(self, parent) AbstractSector.__init__(self, pos, angle, length)
def __init__(self, wave=None): QGraphicsPathItem.__init__(self) if wave: self.loadWave(wave)