Exemplo n.º 1
0
    def paint(self, painter, option, widget):
        """ Draws a filled rectangle and then adds a title """

        # Hide the dotted outline
        itemOption = QStyleOptionGraphicsItem(option)
        if itemOption.state & QStyle.State_Selected != 0:
            itemOption.state = itemOption.state & ~QStyle.State_Selected

        # Draw the rectangle
        QGraphicsRectItem.paint(self, painter, itemOption, widget)

        # Draw text over the rectangle
        font = QFont("Arial", 10)
        painter.setFont(font)
        painter.drawText(self.__node.posX - self.__node.width / 2.0,
                         self.__node.posY - self.__node.height / 2.0,
                         self.__node.width, self.__node.height, Qt.AlignCenter,
                         self.__srcobj.text)

        pixmap = PixmapCache().getPixmap("docstring.png")
        pixmapPosX = self.__node.posX + self.__node.width / 2.0 - \
                     pixmap.width() / 2.0
        pixmapPosY = self.__node.posY - self.__node.height / 2.0 - \
                     pixmap.height() / 2.0
        painter.setRenderHint(QPainter.SmoothPixmapTransform)
        painter.drawPixmap(pixmapPosX, pixmapPosY, pixmap)
        return
Exemplo n.º 2
0
    def paint( self, painter, option, widget ):
        """ Draws a filled rectangle and then adds a title """

        # Hide the dotted outline
        itemOption = QStyleOptionGraphicsItem( option )
        if itemOption.state & QStyle.State_Selected != 0:
            itemOption.state = itemOption.state & ~QStyle.State_Selected

        # Draw the rectangle
        QGraphicsRectItem.paint( self, painter, itemOption, widget )

        # Draw text over the rectangle
        font = QFont( "Arial", 10 )
        painter.setFont( font )
        painter.drawText( self.__node.posX - self.__node.width / 2.0,
                          self.__node.posY - self.__node.height / 2.0,
                          self.__node.width, self.__node.height,
                          Qt.AlignCenter, self.__srcobj.text )

        pixmap = PixmapCache().getPixmap( "docstring.png" )
        pixmapPosX = self.__node.posX + self.__node.width / 2.0 - \
                     pixmap.width() / 2.0
        pixmapPosY = self.__node.posY - self.__node.height / 2.0 - \
                     pixmap.height() / 2.0
        painter.setRenderHint( QPainter.SmoothPixmapTransform )
        painter.drawPixmap( pixmapPosX, pixmapPosY, pixmap )
        return
Exemplo n.º 3
0
    def paint( self, painter, option, widget ):
        """ Draws a filled rectangle and then adds a title """

        # Hide the dotted outline
        itemOption = QStyleOptionGraphicsItem( option )
        if itemOption.state & QStyle.State_Selected != 0:
            itemOption.state = itemOption.state & ~QStyle.State_Selected

        # Draw the rectangle
        pen = painter.pen()
        pen.setJoinStyle( Qt.RoundJoin )
        painter.setPen( pen )
        QGraphicsRectItem.paint( self, painter, itemOption, widget )

        # Draw text over the rectangle
        font = QFont( "Arial", 10 )
        painter.setFont( font )
        painter.setPen( QPen( QColor( 255, 255, 255 ) ) )
        painter.drawText( self.__node.posX - self.__node.width / 2.0,
                          self.__node.posY - self.__node.height / 2.0,
                          self.__node.width, self.__node.height,
                          Qt.AlignCenter,
                          self.__node.label.replace( '\\n', '\n' ) )

        if self.__outside:
            pixmap = PixmapCache().getPixmap( "nonprojectentrydgm.png" )
            pixmapPosX = self.__node.posX - self.__node.width / 2.0 + 2
            pixmapPosY = self.__node.posY + self.__node.height / 2.0 - \
                         pixmap.height() - 2
            painter.setRenderHint( QPainter.SmoothPixmapTransform )
            painter.drawPixmap( pixmapPosX, pixmapPosY, pixmap )
        return
Exemplo n.º 4
0
    def paint(self, painter, option, widget):
        """ Draws a filled rectangle and then adds a title """

        # Hide the dotted outline
        itemOption = QStyleOptionGraphicsItem(option)
        if itemOption.state & QStyle.State_Selected != 0:
            itemOption.state = itemOption.state & ~QStyle.State_Selected

        # Draw the rectangle
        pen = painter.pen()
        pen.setJoinStyle(Qt.RoundJoin)
        painter.setPen(pen)
        QGraphicsRectItem.paint(self, painter, itemOption, widget)

        # Draw text over the rectangle
        font = QFont("Arial", 10)
        painter.setFont(font)
        painter.setPen(QPen(QColor(255, 255, 255)))
        painter.drawText(self.__node.posX - self.__node.width / 2.0,
                         self.__node.posY - self.__node.height / 2.0,
                         self.__node.width, self.__node.height, Qt.AlignCenter,
                         self.__node.label.replace('\\n', '\n'))

        if self.__outside:
            pixmap = PixmapCache().getPixmap("nonprojectentrydgm.png")
            pixmapPosX = self.__node.posX - self.__node.width / 2.0 + 2
            pixmapPosY = self.__node.posY + self.__node.height / 2.0 - \
                         pixmap.height() - 2
            painter.setRenderHint(QPainter.SmoothPixmapTransform)
            painter.drawPixmap(pixmapPosX, pixmapPosY, pixmap)
        return
Exemplo n.º 5
0
    def paint(self, painter, option, widget):
        """ Draws a filled rectangle and then adds a title """

        # Draw the rectangle
        QGraphicsRectItem.paint(self, painter, option, widget)

        # Draw text over the rectangle
        font = QFont("Arial", 10)
        font.setBold(True)
        painter.setFont(font)
        painter.setPen(QPen(QColor(90, 90, 88)))
        painter.drawText(self.__node.posX - self.__node.width / 2.0,
                         self.__node.posY - self.__node.height / 2.0,
                         self.__node.width, self.__node.height, Qt.AlignCenter,
                         self.__node.label)
        return
Exemplo n.º 6
0
    def paint( self, painter, option, widget ):
        """ Draws a filled rectangle and then adds a title """

        # Draw the rectangle
        QGraphicsRectItem.paint( self, painter, option, widget )

        # Draw text over the rectangle
        font = QFont( "Arial", 10 )
        font.setBold( True )
        painter.setFont( font )
        painter.setPen( QPen( QColor( 90, 90, 88 ) ) )
        painter.drawText( self.__node.posX - self.__node.width / 2.0,
                          self.__node.posY - self.__node.height / 2.0,
                          self.__node.width, self.__node.height,
                          Qt.AlignCenter, self.__node.label )
        return
Exemplo n.º 7
0
    def paint( self, painter, option, widget ):
        " Draws a filled rectangle, adds title, classes/funcs/globs sections "

        # Hide the dotted outline
        itemOption = QStyleOptionGraphicsItem( option )
        if itemOption.state & QStyle.State_Selected != 0:
            itemOption.state = itemOption.state & ~QStyle.State_Selected

        # Draw the rectangle
        QGraphicsRectItem.paint( self, painter, itemOption, widget )


        # Start from the bottom to automatically take potential spare
        # pixels for the title
        font = QFont( "Arial", 10 )
        painter.setFont( font )
        posX = self.__node.posX - self.__node.width / 2.0
        posY = self.__node.posY + self.__node.height / 2.0 - 1.5 * self.__pixelsPerLine

        occupiedPixels = 0
        for index in xrange( len( self.__lines ) - 1, 0, -1 ):
            if self.__lines[ index ] is None:
                # Draw a separation line
                painter.drawLine( posX + 1, posY + self.__pixelsPerLine / 2.0,
                                  posX + self.__node.width,
                                  posY + self.__pixelsPerLine / 2.0)
            elif self.__lines[ index ] != "":
                # Draw a text line
                # Sometimes the bottom part of 'g' is not drawn so I add 2
                # spare pixels.
                painter.drawText( int( posX ), int( posY ),
                                  int( self.__node.width ), self.__pixelsPerLine + 2,
                                  Qt.AlignCenter, self.__lines[ index ] )
            occupiedPixels += self.__pixelsPerLine
            posY -= self.__pixelsPerLine

        # Draw the title in bold
        font.setBold( True )
        painter.setFont( font )

        available = self.__node.height - occupiedPixels
        posY = self.__node.posY - self.__node.height / 2.0
        painter.drawText( int( posX ), int( posY ),
                          int( self.__node.width ), int( available ),
                          Qt.AlignCenter, self.__lines[ 0 ] )
        return
Exemplo n.º 8
0
    def paint(self, painter, option, widget):
        " Draws a filled rectangle, adds title, classes/funcs/globs sections "

        # Hide the dotted outline
        itemOption = QStyleOptionGraphicsItem(option)
        if itemOption.state & QStyle.State_Selected != 0:
            itemOption.state = itemOption.state & ~QStyle.State_Selected

        # Draw the rectangle
        QGraphicsRectItem.paint(self, painter, itemOption, widget)

        # Start from the bottom to automatically take potential spare
        # pixels for the title
        font = QFont("Arial", 10)
        painter.setFont(font)
        posX = self.__node.posX - self.__node.width / 2.0
        posY = self.__node.posY + self.__node.height / 2.0 - 1.5 * self.__pixelsPerLine

        occupiedPixels = 0
        for index in xrange(len(self.__lines) - 1, 0, -1):
            if self.__lines[index] is None:
                # Draw a separation line
                painter.drawLine(posX + 1, posY + self.__pixelsPerLine / 2.0,
                                 posX + self.__node.width,
                                 posY + self.__pixelsPerLine / 2.0)
            elif self.__lines[index] != "":
                # Draw a text line
                # Sometimes the bottom part of 'g' is not drawn so I add 2
                # spare pixels.
                painter.drawText(int(posX), int(posY), int(self.__node.width),
                                 self.__pixelsPerLine + 2, Qt.AlignCenter,
                                 self.__lines[index])
            occupiedPixels += self.__pixelsPerLine
            posY -= self.__pixelsPerLine

        # Draw the title in bold
        font.setBold(True)
        painter.setFont(font)

        available = self.__node.height - occupiedPixels
        posY = self.__node.posY - self.__node.height / 2.0
        painter.drawText(int(posX), int(posY), int(self.__node.width),
                         int(available), Qt.AlignCenter, self.__lines[0])
        return
Exemplo n.º 9
0
    def paint(self, painter, option, widget):
        """ Draws a filled rectangle and then adds a title """

        # Draw the rectangle
        QGraphicsRectItem.paint(self, painter, option, widget)

        # Draw text over the rectangle
        font = QFont("Arial", 10)
        font.setBold(True)
        painter.setFont(font)
        painter.setPen(QPen(QColor(90, 90, 88)))
        painter.drawText(self.__node.posX - self.__node.width / 2.0,
                         self.__node.posY - self.__node.height / 2.0,
                         self.__node.width, self.__node.height, Qt.AlignCenter,
                         self.__node.label)

        pixmap = PixmapCache().getPixmap("binarymod.png")
        pixmapPosX = self.__node.posX + self.__node.width / 2.0 - \
                     pixmap.width() / 2.0
        pixmapPosY = self.__node.posY - self.__node.height / 2.0 - \
                     pixmap.height() / 2.0
        painter.setRenderHint(QPainter.SmoothPixmapTransform)
        painter.drawPixmap(pixmapPosX, pixmapPosY, pixmap)
        return
Exemplo n.º 10
0
    def paint( self, painter, option, widget ):
        """ Draws a filled rectangle and then adds a title """

        # Draw the rectangle
        QGraphicsRectItem.paint( self, painter, option, widget )

        # Draw text over the rectangle
        font = QFont( "Arial", 10 )
        font.setBold( True )
        painter.setFont( font )
        painter.setPen( QPen( QColor( 90, 90, 88 ) ) )
        painter.drawText( self.__node.posX - self.__node.width / 2.0,
                          self.__node.posY - self.__node.height / 2.0,
                          self.__node.width, self.__node.height,
                          Qt.AlignCenter, self.__node.label )

        pixmap = PixmapCache().getPixmap( "binarymod.png" )
        pixmapPosX = self.__node.posX + self.__node.width / 2.0 - \
                     pixmap.width() / 2.0
        pixmapPosY = self.__node.posY - self.__node.height / 2.0 - \
                     pixmap.height() / 2.0
        painter.setRenderHint( QPainter.SmoothPixmapTransform )
        painter.drawPixmap( pixmapPosX, pixmapPosY, pixmap )
        return